Skip to content

Lesson 1 of 9 · 24m

SMTP Envelope Versus Message: Where Delivery Decisions Actually Happen

Separate envelope identity from message headers, read SMTP replies correctly, and understand why mail can be delivered while appearing forged.

The first time you debug a serious email incident, someone will paste the From: header into chat and say, "This is definitely what we sent." Maybe. Email has two identities: the envelope used by SMTP and the message shown by the mail client. They are cousins, not twins. Most delivery policy acts on the envelope; most human judgment acts on the display name. Attackers and broken integrations both live in that gap.

The envelope is the transport contract

SMTP transactions begin after connection and greeting with MAIL FROM and one or more RCPT TO commands. Those are the envelope sender and envelope recipients:

EHLO mailer.sudosecurity.org
MAIL FROM:<bounces@mail.sudosecurity.org> SIZE=10422
RCPT TO:<user@example.net> ORCPT=rfc822;user@example.net
DATA

Only after DATA do you send the RFC 5322 message: headers, blank line, body. The From: header inside that message can be SudoSecurity <support@sudosecurity.org> while the envelope sender is a bounce-handling subdomain. That is normal and often desirable.

Envelope sender:  bounces@mail.sudosecurity.org   transport identity, bounces
Header From:      support@sudosecurity.org        human-visible author identity
Header Reply-To:  support+thread-842@sudosecurity.org  replies routed elsewhere

When mail bounces, the receiving system normally sends the failure to the envelope sender, not to the From: header. If you do not control the envelope sender, you do not control bounce processing.

Read SMTP replies like an operator

Reply codes are not decoration. The first digit tells you whether the remote side accepted the command for now:

2xx  accepted or completed
4xx  temporary failure: queue and retry
5xx  permanent failure: do not retry this recipient unchanged

The rest matters too. 550 5.7.1 often means policy rejection; 451 4.7.1 often means greylisting or temporary reputation throttling. Enhanced status codes are the part after the initial three digits, and they are more precise:

250 2.0.0 OK: queued as 4f2c81
421 4.7.0 [172.18.0.2] Our system has detected unusual traffic
550 5.1.1 The email account that you tried to reach does not exist

A 250 after DATA means the receiving server accepted responsibility for the message, not that a human saw it. It may still be spam-foldered, silently discarded later by policy, or bounced after downstream processing.

Test with real SMTP verbs

Do not debug SMTP exclusively through application logs. Use swaks to control the exact envelope, headers, and body:

swaks --server mail.example.net --port 25   --from bounces@mail.sudosecurity.org   --to postmaster@example.net   --h-From 'SudoSecurity <support@sudosecurity.org>'   --h-Subject 'SMTP envelope test'   --body 'Envelope and header identities intentionally differ.'

This quickly shows whether the failure happens at connect, MAIL FROM, RCPT TO, DATA, TLS negotiation, or final acceptance. Application logs often collapse all of those into "send failed."

Field notes

  • From: is cosmetic evidence until correlated with envelope sender, DKIM domain, and received headers.
  • Null envelope sender <> is legitimate for bounce messages; do not block it wholesale or you break failure reporting.
  • RCPT TO acceptance is not proof that the mailbox exists; catch-all domains accept and bounce later.
  • Delivery receipts are unreliable. A 250 is transport acceptance, not user attention.
  • If your application uses a provider API, ask what envelope sender domain it uses and whether you can customize it.

Was this lesson helpful?

Sign in to rate