The SMTP conversation

Read SMTP reply codes

Use the first digit to distinguish progress, success, temporary failure, and permanent failure.

8 minute lesson

~~~

SMTP replies have three digits. 2xx means success, 3xx asks the client to continue, 4xx is a temporary failure, and 5xx is a permanent failure for the current request.

A sender normally queues and retries after 4xx. Repeating the same message forever after 5xx is not useful; the address, content, or policy must change.

Enhanced status codes add detail such as 5.1.1 for a bad destination mailbox. Read the text too, but automate decisions from the codes because server wording varies.

The command stage matters as much as the number:

S: 451 4.7.1 Try again later
S: 550 5.1.1 Mailbox unavailable
S: 552 5.3.4 Message too large

A 451 during RCPT TO defers that recipient. A 552 after DATA rejects the submitted content. Record the command, basic reply, enhanced status, and remote hostname together.

Do not classify every 4xx as “the server is down.” Greylisting, rate limits, mailbox storage, policy checks, and temporary DNS trouble can all defer mail. Back off instead of retrying in a tight loop.

Likewise, a 5xx is permanent for the current attempt and parameters. It does not always mean the address can never receive mail. A too-large message can be changed; an unauthenticated relay attempt can be retried through the correct submission service.

For each reply above, decide whether to queue, change the message, change the route, or notify the sender. State what evidence led to the decision.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →