Guide · SMTP and headers
EHLO vs. HELO: what the SMTP greeting actually tells you
When a mail log shows 250 after EHLO, the server has accepted the greeting. It has not checked a recipient or accepted a message. One SMTP conversation can contain several replies with the same code, each answering a different command. To read a log correctly, pair each reply with the command that led to it, and note whether it came before or after TLS.
- Reading time
- 6 min
What EHLO and HELO tell a receiver
On a plain SMTP connection, the receiving server first sends a 220 greeting. Then the client introduces itself. Both EHLO and HELO carry the client's identity, normally its fully qualified domain name. EHLO also asks the server to list the SMTP service extensions it supports (RFC 5321, sections 3.2 and 4.1.1.1). This extension-capable form is often called ESMTP, or Extended SMTP. HELO is the older introduction, with no extension negotiation.
The identity in the greeting is what the client presents. A 250 reply does not authenticate the message's author, sign anyone in, or confirm the address of a recipient. At that point the client may not have named a sender, a recipient or a message at all. So "EHLO succeeded" helps when you look for a negotiation problem, but says little about why a particular message did not arrive. The name a sending server uses here also matters for its reputation (reverse DNS and the HELO name).
Read a multiline EHLO reply
Here is the start of a fictional SMTP session. C marks the client, S the server, and all host names are examples:
S: 220 mx.example.net ESMTP ready
C: EHLO outbound.example.com
S: 250-mx.example.net
S: 250-SIZE 5242880
S: 250-STARTTLS
S: 250 SMTPUTF8The first 250 line names the receiving server. The next lines advertise extensions:
- SIZE with a number gives the fixed maximum message size in bytes the server will accept; 0 means no fixed maximum (RFC 1870).
- STARTTLS means the server offers to upgrade this connection to TLS (RFC 3207). The word in the list says nothing about whether a TLS handshake has started or succeeded.
- SMTPUTF8 means the server supports internationalized email, so the client may send mailbox names in UTF-8 in the SMTP commands (RFC 6531). It does not mean that any particular internationalized address accepts mail (internationalized email addresses).
The punctuation tells the client when the list is complete. A hyphen straight after the code means more lines follow; the last line has a space after the code (RFC 5321, section 4.1.1.1). Because some servers send a bare code without text, section 4.2 asks clients to be prepared to process the code alone, with or without a trailing space. So test for the continuation hyphen rather than expecting a word on every last line.
Treat the list as a snapshot of that session. A capability seen yesterday, on another mail server or in another connection state does not show that this server offered it on this connection.
What you lose when a client falls back to HELO
If the server answers EHLO with "command not recognized", RFC 5321 (section 3.2) says the client should be able to fall back to HELO. A successful HELO establishes a basic SMTP greeting, but negotiates no extensions: servers must not return the extended EHLO-style reply to HELO. Capabilities the client expected are not negotiated.
A temporary failure, a timeout and an explicit refusal of the presented identity are different cases from a command the server does not understand. Record the exact reply before you decide what to fix. If the client requires encryption and the route cannot provide it, fix the endpoint or the TLS settings. Never take a HELO fallback as a reason to send credentials or mail in plain text.
Why a 250 reply depends on the command
Here is a later excerpt from a different fictional session. It starts after the greeting and is here only to read the replies:
C: MAIL FROM:<billing@example.com>
S: 250 Sender accepted
C: RCPT TO:<customer@example.org>
S: 250 Recipient accepted
C: DATA
S: 354 Ready for message content
C: [message header and body, omitted]
C: .
S: 250 Message queued as EX42These replies mark four different points:
- EHLO, then 250: the server accepted the greeting and may have listed extensions. No mail transaction has started.
- MAIL FROM, then 250: the server accepted the envelope sender for this transaction. It has not accepted a recipient or the message.
- RCPT TO, then 250: the server accepted that envelope recipient for this transaction. It can still reject the whole message once it has the content, and the reply alone proves neither who owns the mailbox nor that mail will be delivered later (verifying an address without sending).
- DATA, then 354, then a final 250: 354 asks the client to send the content. The 250 after the closing dot is the one that matters: with it the server accepts responsibility for delivering the message, retrying it after a temporary failure, or returning a notification to the sender (RFC 5321, section 4.2.5). Another hop or a mailbox filter may still handle it later. A queue identifier, if the server gives one, helps find what happened next on that server; it does not show inbox placement (Message-ID vs. queue ID).
Why STARTTLS requires a new look at the greeting
After a successful STARTTLS handshake, the SMTP session is reset to its initial state. RFC 3207 (section 4.2) requires both sides to discard what they learned before TLS that did not come from the TLS negotiation itself, including the client's EHLO argument and the server's extension list. The client should send EHLO as its first command in the protected session.
The new list may differ. RFC 3207's own example is a server that offers a particular SASL authentication mechanism only after the client presented a suitable certificate. And a server must not advertise STARTTLS again once a TLS handshake has completed.
If a feature seems to be missing, look for the second EHLO before you change any mail or account settings. Confirm that the handshake finished and that the feature was missing from the session after it, rather than reading the earlier plain-text greeting.
The plain-text greeting also has a security weakness: RFC 3207 (section 6) notes that an attacker in the path can delete the 250 STARTTLS line, so the client never tries TLS. Seeing STARTTLS missing from one session can mean exactly that. Between mail servers, MTA-STS and DANE let a sender refuse such a downgrade (MTA-STS and TLS reporting).
What to save in a troubleshooting note
Write down the timestamp, each command with its full reply, and whether TLS was active. For a missing message, note whether the server accepted responsibility at the end of DATA, then follow that handoff with the receiving service's trace. Keep real addresses, credentials and message content out of public examples. To read a specific SMTP failure once you have found the stage that produced it, look up its code in the bounce code dictionary.
Questions
Should a client use EHLO or HELO?
EHLO. RFC 5321 says a client should start a session with EHLO (section 4.1.1.1). Section 3.2 says it should be able to fall back to HELO when the server answers "command not recognized".
Does a 250 reply to RCPT TO mean the mailbox exists?
No. It means the server accepted that recipient for this transaction. It can still reject the message after DATA, and some domains accept every recipient (catch-all emails).
Why did the extension list change after STARTTLS?
The session restarts after the TLS handshake, and the server may offer a different list in the protected session. It must no longer list STARTTLS.
Try it
See which mail servers a domain publishes with the MX lookup, or check an address with the free email checker.
Related
- Glossary: HELO and EHLO.
- Glossary: STARTTLS.
- STARTTLS vs. implicit TLS: which mode belongs on ports 587 and 465.
- Bounce code dictionary.
Related guides
- SMTP envelope sender vs. From header: which address goes where?
- Message-ID vs. SMTP queue ID: what to send support
- MTA-STS and TLS reporting explained
- Reverse DNS (PTR records) for mail servers
- STARTTLS vs. implicit TLS: which mode belongs on ports 587 and 465?
- All guides
Sources
- IETF: RFC 5321, Simple Mail Transfer Protocol: sections 3.2 (EHLO and the HELO fallback), 4.1.1.1 (EHLO syntax and multiline replies), 4.2 (reply format), 4.2.5 (replies after DATA).
- IETF: RFC 1870, SMTP Service Extension for Message Size Declaration.
- IETF: RFC 6531, SMTP Extension for Internationalized Email.
- IETF: RFC 3207, SMTP Service Extension for Secure SMTP over TLS: section 4.2 (the reset after STARTTLS), section 6 (the stripped STARTTLS line).
How we wrote this: drafted by the email-validation.org team with the help of AI writing tools, from our product documentation and the sources linked in the text.