MailSlurp logo

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 ready
  • 235: authentication successful
  • 250: requested action completed
  • 221: session closing

Intermediate (3xx)

  • 334: auth challenge
  • 354: start message input

Temporary failures (4xx)

  • 421: service unavailable / connection closing
  • 450: mailbox unavailable (temporary)
  • 451: local processing error
  • 452: insufficient system storage

Temporary failures usually require retry with backoff.

Permanent failures (5xx)

  • 500: syntax error, command unrecognized
  • 501: syntax error in parameters
  • 503: bad sequence of commands
  • 530: authentication required
  • 535: auth credentials rejected
  • 550: mailbox unavailable / policy rejection / relay denied
  • 551: user not local
  • 552: mailbox exceeded storage allocation
  • 553: invalid mailbox syntax
  • 554: transaction rejected

Permanent failures usually require config/policy/address fixes before retry.

SMTP command-level troubleshooting workflow

  1. Confirm port and TLS mode pairing (587 + STARTTLS, 465 implicit TLS).
  2. Validate capability advertisement after EHLO.
  3. Validate auth mechanism offered by server (AUTH variants).
  4. Validate envelope sender/recipient syntax.
  5. Inspect response class and exact code to choose retry vs fix.
  6. Validate inbox outcomes with receive-side tests.

Useful follow-on guides:

Testing checklist before release

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.

Next steps