In SMTP, how does the envelope sender given in MAIL FROM differ from the From header a recipient sees?
answer
- two layers in one transaction
- routing and bounces versus display
- RCPT TO is not the To line
- RFC 5321 section 7.2
basics
~20 sMAIL FROM is the envelope reverse-path, sent in the SMTP dialog and used for bounces; From is the author's address inside the message content. RFC 5321 requires no relationship between them, so they can differ.
solid answer
~40 sAn SMTP transaction carries an **envelope** (the `MAIL FROM` reverse-path and one `RCPT TO` per recipient) and then the **content** sent after `DATA`, whose RFC 5322 header holds `From`, `Sender`, `Reply-To`, `To`, `Cc` and sometimes `Bcc`. Servers deliver to the `RCPT TO` addresses and send non-delivery reports to the `MAIL FROM` address; the reader's client shows `From`. RFC 5321 section 7.2 says there is no inherent relationship between the envelope addresses and the header addresses, so a newsletter can bounce to a sending service's address while `From` shows the brand, and a Bcc recipient normally appears only as a `RCPT TO`. That gap is how spoofing slips by: SPF evaluates the `MAIL FROM` domain, and it is DMARC that ties a result back to the visible `From` domain.
go deeper
Recall the two layers: MAIL FROM and RCPT TO in the dialog, From and To in the content. Say which one bounces use and which one the reader sees.
Explain the RFC 5322 originator fields (From, Sender, Reply-To) against the envelope, why a Bcc recipient sits only in RCPT TO, and why RFC 5321 deliberately leaves the layers unrelated.
Show that you read both layers on a real message: Return-Path for the envelope sender, Authentication-Results for which domain each check covered, and the From address rather than its display name.
Argue why forcing the envelope and From to match would break sending services, lists and delegated sending, and which receiver-side checks a domain relies on instead.
## Two layers in one transaction RFC 5321 (October 2008) describes what SMTP moves as a **mail object** with two parts: - the **envelope**, sent as SMTP commands: an originator address for error reports, one or more recipient addresses and optional extension parameters; - the **content**, sent after the `DATA` command: a header section in the RFC 5322 format and a body. The two layers are written by different actors and read by different software. Servers act on the envelope; the person reading the mail sees the header. Confusing them is the root of most "how did this spoofed message get through" conversations. ## The envelope: MAIL FROM and RCPT TO Here is a mail administrator's own test of a server they run, with an ordinary message: 1. `C: MAIL FROM:<[email protected]>` 2. `S: 250 OK` 3. `C: RCPT TO:<[email protected]>` 4. `S: 250 OK` 5. `C: RCPT TO:<[email protected]>` 6. `S: 250 OK` 7. `C: DATA` 8. `S: 354 Start mail input; end with <CRLF>.<CRLF>` 9. The client sends `From: "Example News" <[email protected]>`, `To: [email protected]`, a subject, a blank line and the body, then the end-of-data line. - `MAIL FROM` carries the **reverse-path**. RFC 5598, the mail architecture document, notes that the name is misleading: it need not name the author or the party that submitted the message, only the address that should hear about transfer problems. A bounce is itself sent with an empty reverse-path, `MAIL FROM:<>`, so that one failure cannot trigger another report. - `RCPT TO` carries each **recipient** the server must deliver to. Bob above is a blind copy: he is in the envelope and absent from the header. ## The header: who wrote it, who sent it, who it is for | Field | Set by (RFC 5598) | Meaning (RFC 5322 section 3.6) | |---|---|---| | `From` | Author | The mailbox of the person or system responsible for writing the message; exactly one `From` field | | `Sender` | Originator | The agent that actually transmitted it; required when `From` lists more than one mailbox | | `Reply-To` | Author | Where the author suggests replies go; replies default to `From` without it | | `To`, `Cc` | Author | Primary and secondary recipients as the reader sees them | | `Bcc` | Author | Blind recipients; normally removed from the copies other recipients see | None of these fields steers delivery. A `To` line can name a mailing list while each `RCPT TO` names one member, and RFC 5322 lets an implementation keep a `Bcc` line in the blind recipient's own copy, so "Bcc lives only in the envelope" is the usual case, not a rule. ## No required relationship, by design RFC 5321 section 7.2 is explicit: there is **no inherent relationship** between the reverse or forward addresses in the envelope and the addresses in the header section, and receiving systems SHOULD NOT try to deduce one. Section 7.1 goes further and calls efforts to stop users setting the envelope return path and the header `From` to other valid addresses "largely misguided", because legitimate mail depends on the freedom: - a sending service puts its own bounce address in `MAIL FROM` so it can process failures for the brand in `From`; - a mailing list sends errors to its maintainer, not to the author; - an assistant sends on behalf of a manager, which is what `Sender` exists to record. ## Why this is where spoofing slips by Because SMTP itself authenticates neither layer, each later check reads one specific identity: 1. **SPF** evaluates the connecting IP address against the `MAIL FROM` domain (or the `HELO` name). 2. **DKIM** verifies a signature for the domain in the signature's `d=` tag. 3. **DMARC** is the only one of the three that is about the `From` domain the reader sees; how it relates the other two results to that domain is covered with DMARC alignment. A message can therefore pass SPF for one domain while its `From` shows another. The display name in `From`, the phrase before the angle brackets, is not checked by any of them. ## What a mail administrator reads - The `Return-Path` field on the delivered copy, written at final delivery from `MAIL FROM`. - The `Authentication-Results` field the receiving system added, which records which domain each check covered, such as `smtp.mailfrom` for SPF and `header.from` for DMARC. - The `From` address itself, not just its display name, because that is the identity the reader trusts.
- What do the Sender and Reply-To header fields add, and does either one affect where bounces go?`Sender` names the agent that transmitted the message when it differs from the author in `From`, and RFC 5322 requires it when `From` lists several mailboxes. `Reply-To` is where the author asks human replies to go. Neither steers bounces: non-delivery reports go to the envelope reverse-path from `MAIL FROM`, which RFC 5321 says MUST be the target of delivery error messages.
- Why do recipients who are not in the To or Cc lines still receive the message?Delivery follows the envelope, not the header. Each `RCPT TO` names a mailbox the server must deliver to, whatever the `To` and `Cc` lines say. Blind copies and list members appear only as `RCPT TO` commands, and RFC 5321 section 7.2 says servers SHOULD NOT copy the full recipient set into the header.
A postal envelope and the letterhead inside it: the carrier delivers by the address on the envelope and returns undeliverable post to the envelope's return address, and the carrier never checks that the letterhead names the same sender.
- Says the receiving server rejects mail whose MAIL FROM and From domains differ
- Believes bounces go to the From address or to Reply-To
- Thinks the To and Cc lines decide who receives the message
- Claims SPF checks the From header the reader sees
- Calls any envelope and header mismatch proof of spoofing