blog
SMTP Commands and Response Codes (Practical Reference)
Use this SMTP commands and response codes reference to debug authentication, TLS, recipient, and delivery issues in production email workflows.
If you searched for SMTP commands and responses, use this page as your production debugging reference.
Quick answer
SMTP is a command/response protocol:
- client sends commands (
EHLO,MAIL FROM,RCPT TO,DATA) - server replies with numeric codes (
220,250,354,550) - response classes show whether to continue, retry, or fix configuration
Minimal SMTP session example
S: 220 smtp.example.com ESMTP ready
C: EHLO app.example.com
S: 250-smtp.example.com
S: 250-STARTTLS
S: 250-AUTH LOGIN PLAIN
C: STARTTLS
S: 220 Ready to start TLS
C: EHLO app.example.com
S: 250-AUTH LOGIN PLAIN
C: AUTH LOGIN
S: 235 Authentication successful
C: MAIL FROM:<sender@example.com>
S: 250 2.1.0 OK
C: RCPT TO:<recipient@example.com>
S: 250 2.1.5 OK
C: DATA
S: 354 End data with <CR><LF>.<CR><LF>
C: Subject: SMTP debug test
C:
C: Hello
C: .
S: 250 2.0.0 Queued
C: QUIT
S: 221 Bye
Core SMTP commands
| Command | What it does | Typical use |
|---|---|---|
EHLO |
Announces client and requests capabilities | Start modern SMTP session |
HELO |
Legacy greeting | Fallback where ESMTP unsupported |
STARTTLS |
Upgrades connection to TLS | Secure transport before auth |
AUTH |
Authenticates client identity | Submission through provider |
MAIL FROM |
Sets envelope sender | Start transaction |
RCPT TO |
Adds recipient | One call per recipient |
DATA |
Sends message headers/body | Transfer message content |
RSET |
Clears current transaction state | Recover from input mistakes |
NOOP |
Health/keepalive command | Connection checks |
QUIT |
Ends session | Clean disconnect |
Legacy or restricted commands (VRFY, EXPN) are commonly disabled for security reasons.
SMTP response code reference
Success (2xx)
220: service ready235: authentication successful250: requested action completed221: session closing
Intermediate (3xx)
334: auth challenge354: start message input
Temporary failures (4xx)
421: service unavailable / connection closing450: mailbox unavailable (temporary)451: local processing error452: insufficient system storage
Temporary failures usually require retry with backoff.
Permanent failures (5xx)
500: syntax error, command unrecognized501: syntax error in parameters503: bad sequence of commands530: authentication required535: auth credentials rejected550: mailbox unavailable / policy rejection / relay denied551: user not local552: mailbox exceeded storage allocation553: invalid mailbox syntax554: transaction rejected
Permanent failures usually require config/policy/address fixes before retry.
SMTP command-level troubleshooting workflow
- Confirm port and TLS mode pairing (
587+ STARTTLS,465implicit TLS). - Validate capability advertisement after
EHLO. - Validate auth mechanism offered by server (
AUTHvariants). - Validate envelope sender/recipient syntax.
- Inspect response class and exact code to choose retry vs fix.
- Validate inbox outcomes with receive-side tests.
Useful follow-on guides:
Testing checklist before release
- Run command-level checks in Email Sandbox.
- Add delivery assertions in Email integration testing.
- Observe failure events via Email Webhooks.
- Run Email deliverability tests before campaign launches.
FAQ
What is the most important SMTP command?
EHLO is critical because it starts capability negotiation for TLS and auth.
Does 250 always mean delivery success?
No. It means SMTP acceptance at that hop, not guaranteed inbox placement.
Should I retry 5xx responses?
Usually no until root cause is fixed. Retry logic is mainly for 4xx temporary failures.