Current standard
What this RFC defines
RFC 5321 is the current SMTP standard. It defines the complete protocol for transferring email between servers: the TCP session lifecycle, the EHLO greeting, the MAIL FROM and RCPT TO envelope commands, the DATA transaction, and the QUIT teardown. Every mail server on the internet, whether Postfix, Exchange, or SendGrid, implements this document.
Where you see it in practice
The three-digit reply codes in your bounce messages (220, 250, 421, 450, 550, 554) are defined here. When a receiving server rejects your message with “550 5.1.1 User unknown”, that code structure traces back to RFC 5321 section 4.2. RFC 5321 asks the client to send its fully-qualified domain name in EHLO (section 4.1.1.1). It does not require that name to match the PTR record of the sending IP: that check is a receiver policy, but one so widely applied (Gmail, Microsoft, Spamhaus-based filters) that missing or mismatched reverse DNS is one of the most common causes of rejection.
Implementation across major MTAs
Every production mail transfer agent implements RFC 5321. Postfix, Exim, Sendmail, and Microsoft Exchange are the four dominant open-source and enterprise MTAs, and each conforms to the base protocol described in the document, with minor policy differences in areas the RFC leaves as SHOULD or MAY. Cloud services like Amazon SES, SendGrid, Mailgun, Postmark, and SparkPost also speak RFC 5321 on their outbound relays and accept it on their inbound MX endpoints. The universality of RFC 5321 conformance is why interoperability at the SMTP layer is essentially a solved problem in 2026.
Common misconceptions
Three misconceptions recur frequently. First, RFC 5321 does not mandate authentication; SMTP AUTH is defined in RFC 4954 as an extension. A vanilla RFC 5321 conversation does not require the sender to authenticate, which is why open relays existed for decades before operational best practice mandated closing them. Second, RFC 5321 does not require TLS; STARTTLS is defined in RFC 3207 as an optional extension. RFC 8314 later declared cleartext obsolete for submission, but RFC 5321 itself remains protocol-agnostic on transport security. Third, the SIZE line in an EHLO response is a hint, not a hard commitment; a receiving server can accept a message larger or smaller than the advertised limit depending on per-recipient policy.
Testing conformance
The classic conformance check is a telnet session to port 25 (or 587 for submission), where you type each command manually and verify that the responses follow the reply-code grammar. Automated conformance is typically done with tools like swaks or the Postfix smtp-source utility. For inbound conformance, the receiving MTA logs should show your EHLO greeting, MAIL FROM and RCPT TO exchanges, and the final DATA acceptance. Any of these steps rejecting valid input, or accepting clearly invalid input, indicates a conformance issue.
RFC 5321 (October 2008) is the current Simple Mail Transfer Protocol standard. It defines the complete server-to-server email transfer protocol: TCP session, EHLO handshake, MAIL FROM and RCPT TO envelope, DATA transaction, three-digit reply codes, and QUIT teardown. Obsoletes RFC 2821 (2001) and RFC 821 (1982). Works alongside RFC 5322 (message format), RFC 3207 (STARTTLS), RFC 4954 (SMTP AUTH), and RFC 6409 (message submission on port 587). A revision, draft-ietf-emailcore-rfc5321bis, has been approved by the IESG and is waiting in the RFC Editor queue; until it is published under a new number, RFC 5321 remains the standard (see What comes after RFC 5321).
RFC 5321 at a glance
| Aspect | Detail |
|---|---|
| Purpose | Server-to-server email transfer protocol |
| Transport | TCP, typically port 25 (server-to-server) or 587 (client submission per RFC 6409) |
| Session model | Stateful command/response with three-digit reply codes |
| Core commands | EHLO, MAIL FROM, RCPT TO, DATA, QUIT (plus RSET, NOOP, VRFY, EXPN, HELP) |
| Reply code structure | 3-digit numeric: first digit is severity class, remaining digits refine |
| Extension mechanism | EHLO response advertises supported extensions per RFC 1869 |
| Published | October 2008 (obsoletes RFC 2821, RFC 821) |
| Status | Current standard; revision (5321bis) approved and in the RFC Editor queue |
Complete SMTP command reference
RFC 5321 defines a small set of commands that flow between client (sending MTA) and server (receiving MTA). Every SMTP conversation follows the same pattern: server greeting, EHLO exchange, envelope commands, DATA, and QUIT.
| Command | Purpose | Example | Section |
|---|---|---|---|
HELO | Legacy greeting (RFC 821), rarely used today | HELO mail.example.com | 4.1.1.1 |
EHLO | Extended greeting, triggers capability advertisement | EHLO mail.example.com | 4.1.1.1 |
MAIL FROM | Envelope sender (Return-Path) | MAIL FROM:<sender@example.com> | 4.1.1.2 |
RCPT TO | Envelope recipient (one per command) | RCPT TO:<user@example.com> | 4.1.1.3 |
DATA | Begin message body transfer, ends with . on line alone | DATA | 4.1.1.4 |
RSET | Abort current transaction, keep connection | RSET | 4.1.1.5 |
VRFY | Verify address exists (often disabled for anti-harvesting) | VRFY user@example.com | 4.1.1.6 |
EXPN | Expand mailing list (usually disabled) | EXPN list@example.com | 4.1.1.7 |
HELP | Request server-side help text | HELP | 4.1.1.8 |
NOOP | No operation, keep-alive | NOOP | 4.1.1.9 |
QUIT | End session | QUIT | 4.1.1.10 |
SMTP reply code structure
Every SMTP command produces a three-digit reply code. The first digit indicates the severity class; the second digit categorizes the source; the third digit adds specificity. Modern deployments extend this with enhanced status codes per RFC 3463 (see also DSN parsing guide for practical parsing).
| First digit | Class | Meaning | Common examples |
|---|---|---|---|
| 2xx | Success | Command accepted and completed | 220 Ready, 221 Bye, 250 OK, 251 User forwarded |
| 3xx | Intermediate | Awaiting more input from client | 354 Start mail input (after DATA) |
| 4xx | Transient failure | Retry later, may succeed | 421 Service unavailable, 450 Mailbox busy, 451 Local error, 452 Insufficient storage |
| 5xx | Permanent failure | Do not retry, address the underlying issue | 550 Mailbox unavailable, 551 User not local, 552 Storage full, 553 Bad address, 554 Transaction failed |
Each code has its own troubleshooting page with real bounce samples and fixes per mail server: browse the full SMTP reply code library.
Size limits defined in RFC 5321
Section 4.5.3.1 sets the minimum sizes every SMTP implementation must accept. Servers may accept more, but anything that stays within these limits must work everywhere. These numbers are also why email validation libraries reject some addresses as too long.
| Object | Limit | What it means in practice |
|---|---|---|
| Local part (before the @) | 64 octets | firstname.lastname must fit in 64 characters (ASCII) |
| Domain | 255 octets | Upper bound for the part after the @ |
| Path (address in MAIL FROM or RCPT TO) | 256 octets, including the angle brackets | A full address can therefore be at most 254 characters |
| Command line | 512 octets, including CRLF | Limit for one SMTP command such as RCPT TO:<...> |
| Reply line | 512 octets, including CRLF | Limit for one line of a server response |
| Text line in the message | 1000 octets, including CRLF | Long lines in HTML emails must be wrapped or encoded (quoted-printable or base64) |
| Recipients per transaction | At least 100 must be accepted | Servers can refuse more with a 452 reply, so senders must be ready to split |
What the big providers actually allow
RFC 5321 sets floors, not ceilings: every server must accept at least what the table above lists, and each provider then picks its own limits. These are the values documented by the providers themselves, and the ones you actually hit when a message bounces.
| Provider or MTA | Maximum message size | Recipients per message | Bounce you get when you exceed it |
|---|---|---|---|
| Gmail and Google Workspace | 25 MB to send, 50 MB to receive (Google announced higher limits for Enterprise Plus in 2026) | Set by Google’s sending limits for the account type (consumer or Workspace) | 552 message size exceeded |
| Microsoft 365 (Exchange Online) | Configurable by the admin up to 150 MB | 500 by default, customizable up to 1,000 | 552 5.3.4, or a 452 / 550 when the recipient limit is reached |
| Postfix (default settings) | message_size_limit = 10240000 bytes (about 10 MB) | smtpd_recipient_limit = 1000 | 552 for size; recipients over the limit receive a temporary 452 so the sender can retry them |
| RFC 5321 minimum | At least 64K octets must be accepted (§4.5.3.1.7); servers announce their real limit with the SIZE extension (RFC 1870) | At least 100 must be accepted | 452 “too many recipients” means: send the rest in a new transaction |
A complete SMTP dialogue
S: 220 mx.example.com ESMTP Postfix
C: EHLO mail.sender.com
S: 250-mx.example.com Hello mail.sender.com [192.0.2.10]
S: 250-SIZE 52428800
S: 250-8BITMIME
S: 250-STARTTLS
S: 250-ENHANCEDSTATUSCODES
S: 250-PIPELINING
S: 250-DSN
S: 250-CHUNKING
S: 250 SMTPUTF8
C: MAIL FROM:<alice@sender.com>
S: 250 2.1.0 Ok
C: RCPT TO:<bob@example.com>
S: 250 2.1.5 Ok
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: From: Alice <alice@sender.com>
C: To: Bob <bob@example.com>
C: Subject: Test message
C:
C: Hello Bob, this is a test.
C: .
S: 250 2.0.0 Ok: queued as ABC123
C: QUIT
S: 221 2.0.0 Bye
Common ESMTP extensions
The EHLO response advertises server capabilities as extensions per RFC 1869. Modern SMTP servers implement dozens of extensions; the essentials are listed below.
| Extension | Advertised as | Defined in | Purpose |
|---|---|---|---|
| SIZE | SIZE 52428800 | RFC 1870 | Advertise maximum message size in bytes |
| 8BITMIME | 8BITMIME | RFC 6152 | Accept 8-bit MIME content without encoding |
| STARTTLS | STARTTLS | RFC 3207 | Upgrade cleartext connection to TLS |
| AUTH | AUTH LOGIN PLAIN | RFC 4954 | Client authentication (list of mechanisms) |
| PIPELINING | PIPELINING | RFC 2920 | Batch multiple commands without waiting for reply |
| ENHANCEDSTATUSCODES | ENHANCEDSTATUSCODES | RFC 2034 | Return X.Y.Z codes alongside 3-digit codes |
| DSN | DSN | RFC 3464 | Support delivery status notifications |
| CHUNKING | CHUNKING | RFC 3030 | Transfer message body in binary chunks (BDAT) |
| SMTPUTF8 | SMTPUTF8 | RFC 6531 | Support internationalized mailbox names |
| BINARYMIME | BINARYMIME | RFC 3030 | Accept binary MIME parts (requires CHUNKING) |
Common SMTP implementation pitfalls
MAIL FROM:<"Sender Team" <team@example.com>> is a syntax error. Use only the bare address: MAIL FROM:<team@example.com>. Display names go in the From header inside DATA.From the RFC to the bounce: what breaks in practice
Most SMTP rejections you will see trace back to one rule in RFC 5321, or to a receiver policy built on top of it. This table connects the two, with a troubleshooting page for each case.
| Rule or policy | Where it comes from | Typical rejection | Fix |
|---|---|---|---|
| EHLO must carry the client’s real domain name | RFC 5321 §4.1.1.1, plus receiver checks | 550 Access denied: invalid HELO name | Send a resolvable FQDN in EHLO, never localhost or a bare IP |
| Reverse DNS must exist and match | Receiver policy (not required by RFC 5321) | 421 No reverse DNS, Spamhaus HELO and rDNS checks | Publish a PTR that resolves back to the IP and matches the EHLO name |
| Servers may cap recipients per transaction (minimum 100) | RFC 5321 §4.5.3.1.8 and §4.5.3.1.10 | 452 4.5.3 Too many recipients | Treat 452 as temporary: send the remaining recipients in a new transaction |
| Message larger than the server accepts | SIZE extension (RFC 1870) | 552 5.3.4 Message size exceeds fixed maximum | Compress, split, or send a download link |
| Relaying only for authorized clients | RFC 5321 §3.6 (relaying), enforced by every MTA | 550 5.7.1 Relaying denied, 503 Authentication required | Authenticate on port 587, or send to a domain the server is MX for |
| 4xx means try again later | RFC 5321 §4.2.1 and §4.5.4 | 421 4.7.0 Too many connections, 452 4.2.2 Mailbox full | Queue and retry with back-off; never retry a 5xx the same way |
| Text lines limited to 1,000 octets | RFC 5321 §4.5.3.1.6 | Rejections or broken HTML when a line is too long | Encode HTML bodies in quoted-printable or base64 |
Migration from RFC 2821 to RFC 5321
| Aspect | RFC 2821 (2001) | RFC 5321 (2008) | Impact if code targets 2821 |
|---|---|---|---|
| Core protocol | Complete SMTP | Identical semantics with clarifications | None |
| Reply code registry | Enumerated in RFC | Delegated to IANA | Update reference; no code change |
| Address literal syntax | IPv4 only in bracket form | Adds IPv6 with IPv6: tag | Update address parser for IPv6 |
| Errata integration | Separate errata | Errata integrated in main text | None |
| Internationalization | ASCII only | ASCII base with pointer to RFC 6531 for SMTPUTF8 | None (extension is separate RFC) |
| SIZE recommendations | Section 3.1.1 | Clarified in section 4.5.3.1.5 | Review SIZE handling logic |
What comes after RFC 5321
The IETF EMAILCORE working group has revised the core email standards. Its SMTP revision, draft-ietf-emailcore-rfc5321bis, has been approved by the IESG with the intended status of Internet Standard and sits in the RFC Editor queue. The matching revision of the message format (5322bis) is in the same queue, and both are waiting for a companion Applicability Statement, still being finalized, that gives guidance on using the core protocols.
Related standards and further reading
- RFC 5322: Internet Message Format (headers and body of the actual message)
- RFC 6409: Message Submission (port 587 client-to-server distinction)
- RFC 3207: STARTTLS extension for SMTP over TLS
- RFC 4954: SMTP AUTH extension
- RFC 8314: Cleartext considered obsolete for submission/access
- RFC 6152: 8-bit MIME transport
- RFC 1869: The EHLO extension mechanism
- DSN Parsing Guide: reading bounce reports produced by SMTP failures
- Authentication-Results Header: interpreting SPF, DKIM, DMARC verdicts
- Hard Bounce vs Soft Bounce: 4xx vs 5xx handling patterns
- PTR and rDNS Records: FCrDNS setup for EHLO compliance
- Received Headers and Email Trace Chain: reading the Received chain SMTP produces
- Postfix Guide: configuring a common RFC 5321 implementation
Frequently asked questions
What is the difference between HELO and EHLO?
HELO is the legacy greeting from RFC 821 (1982). EHLO is the extended greeting introduced in RFC 1869 and codified in RFC 5321. When a client sends EHLO, the server responds with a multi-line reply listing all supported extensions (SIZE, STARTTLS, AUTH, PIPELINING, and others). HELO produces only a single greeting line without capability information. Modern clients always send EHLO first; if the server responds with a syntax error, they fall back to HELO. In 2026, every production SMTP server supports EHLO; HELO is retained purely for backward compatibility.
What is the maximum length of an email address under RFC 5321?
The local part (before the @) is limited to 64 octets and the domain to 255 octets. The binding limit is the path used in MAIL FROM and RCPT TO, which is 256 octets including the angle brackets. In practice, a deliverable email address is at most 254 characters long.
Does RFC 5321 require authentication?
No. RFC 5321 defines the base SMTP protocol; authentication is a separate extension in RFC 4954. A vanilla RFC 5321 conversation does not require the client to authenticate. This is why open relays existed for decades; the protocol did not mandate closure. Modern operational best practice requires AUTH for message submission (per RFC 6409 and RFC 8314) but server-to-server relay per RFC 5321 remains authentication-optional.
Does RFC 5321 require TLS?
No. RFC 5321 is transport-security-agnostic; STARTTLS is defined as an optional extension in RFC 3207. RFC 8314 (2018) declared cleartext obsolete for message submission and access, but did not amend RFC 5321 for server-to-server relay. Practical reality in 2026: cleartext SMTP relay still occurs when both peers lack STARTTLS support, though this is uncommon at reputable providers. TLS-required policies (MTA-STS, DANE) sit on top of RFC 5321 as separate mechanisms.
What is the difference between MAIL FROM and the From header?
MAIL FROM is the envelope sender, a protocol-level attribute of the SMTP conversation. It becomes the Return-Path header of the delivered message and is used for bounce routing. The From header is a message-level attribute inside DATA, defined by RFC 5322, that names the visible sender to the recipient. The two can differ (a common pattern with newsletter platforms where MAIL FROM points at a bounce-processing subdomain but From displays the company brand). Anti-spoofing mechanisms like DMARC require alignment between these two identities per configured policy.
Why do some servers disable VRFY and EXPN?
Both commands allow a client to query which addresses exist on a server without sending mail. Spammers used VRFY to harvest valid addresses from target domains at scale. Modern operational best practice disables both commands on internet-facing MTAs to prevent address harvesting. RFC 5321 section 3.5.3 explicitly permits this: implementations MAY implement VRFY as a no-op returning 252 (cannot verify) to avoid disclosing address existence. Most production Postfix and Exchange deployments disable VRFY and EXPN entirely.
What happens when a message hits the SIZE limit?
If the client sent the SIZE parameter with MAIL FROM and the value exceeds the server-advertised limit, the server rejects at MAIL FROM with a 552 or 452 code before any data transfer. If the client did not declare SIZE, the server can still reject after DATA if the actual message exceeds its limit. Either path produces a bounce back to the sender. Some servers accept messages slightly over the advertised limit as a courtesy; others enforce strictly. The SIZE extension itself is defined in RFC 1870, not in RFC 5321.
Did this guide save you time?
SMTPedia is free and independent. A coffee helps keep every guide accurate.
Buy SMTPedia a coffeeAbout the Author

Alaa · LinkedIn
Email infrastructure specialist with 8+ years of hands-on experience in SMTP, deliverability, and email verification. I’ve configured and troubleshot mail systems across Postfix, Exchange, and cloud relays, managed IP reputation and warmup campaigns, and built verification pipelines processing millions of addresses. My work spans DNS authentication (SPF, DKIM, DMARC, BIMI), bounce handling, blocklist monitoring, and compliance frameworks including CAN-SPAM and GDPR. I write every article on SMTPedia to give email professionals, developers, and marketers the accurate, RFC-grounded reference they need.
About SMTPedia
SMTPedia is an independent email industry reference covering SMTP, IMAP, POP3, email deliverability, marketing platforms, DNS authentication, and email verification. Every article is researched from official provider documentation, IETF RFCs, and industry best practices. Settings and configurations are verified quarterly.
We are cited as a source by ChatGPT, Microsoft Copilot, and thousands of email professionals worldwide. Learn more about our editorial process.