The SMTP conversation

Build the SMTP envelope

Use MAIL FROM and RCPT TO to identify the reverse path and every envelope recipient.

8 minute lesson

~~~

A mail transaction begins with MAIL FROM. Its address is the reverse path used for delivery-status messages. A bounce uses an empty reverse path, written <>, to avoid bounce loops.

Each RCPT TO adds one envelope recipient. The server can accept one recipient and reject another before receiving the message body.

C: MAIL FROM:<alice@example.org>
S: 250 OK
C: RCPT TO:<bob@example.net>
S: 250 Accepted

Do not infer the envelope from the visible From and To fields. Inspect the SMTP transaction or delivery logs when routing is the question.

Recipient decisions are independent:

C: MAIL FROM:<alice@example.org>
S: 250 2.1.0 Sender accepted
C: RCPT TO:<bob@example.net>
S: 250 2.1.5 Recipient accepted
C: RCPT TO:<missing@example.net>
S: 550 5.1.1 Mailbox does not exist

The client can continue with DATA for Bob. It must not include the rejected address in the accepted recipient set. If no recipient is accepted, there is no useful message transaction to continue.

MAIL FROM can also carry advertised extension parameters such as SIZE or SMTPUTF8. RCPT TO can carry recipient-specific extension data. Send only parameters negotiated through EHLO.

Acceptance at RCPT TO is not final delivery. The receiving server can still reject the content after DATA, or accept it and later encounter a delivery failure that requires a status notification.

Extend the transcript with DATA, a short message, and a final 250. Then list the exact recipients for which the server accepted responsibility.

Lesson completed

Take this course offline

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

Get the download library →