How the Internet works

Applications, chapter 32 of 36

Mail: SMTP and Forty Years of Patches

In May 2026 DMARC reached the standards track and forbade receivers to reject mail on p=reject alone.

Sam finishes a note to kim@example.net and clicks Send. The laptop opens a TLS connection to port 465 of smtp.example.org, hands over a message of 873 octets, and is done, without a single packet to example.net. From there the message moves by store and forward, and none of the servers on the way has to believe what it says about where it came from.

4 to 5 days
what RFC 5321 says a give-up time generally needs to be at least. Stalwart 1.0.1 by default expires a message after 3 days
96.13%
of messages from Tunisia reaching Gmail in April 2015 that came from STARTTLS-stripping hosts
5,000 a day
the Gmail volume above which senders must publish SPF, DKIM, and DMARC since February 2024

mx.example.net judges one message

SPF reads the envelope, DKIM the signature, and DMARC compares both with the From: field that Kim reads. Change the sender, the policy, and the rule for p=reject.

Why does a message have two sets of addresses?

MAIL FROM and RCPT TO form the envelope, and everything after DATA is content (RFC 5321, Section 2.3.1). Error reports go to the envelope sender. Kim's client displays the From: and To: fields, and SMTP never compares the two sets.

Mailing lists, forwarders, and bounces depend on that independence. RFC 5321, Section 7.1 calls efforts to make it more difficult for users to point the envelope return path and the header From: at valid addresses other than their own "largely misguided", words that DMARC later works against.

Where does the message end?

At a line holding a single period, which SMTP inherited from the FTP MAIL command of RFC 385 (August 1972). The line ...and bring the console cable. starts with a period, so the client doubles it and the server removes the extra one (RFC 5321, Section 4.5.2).

A line may be at most 1,000 octets including CRLF, not counting a doubled dot (RFC 5321, Section 4.5.3.1.6).

How does smtp.example.org find the server for example.net?

It looks up MX records, which Craig Partridge specified in RFC 974 (January 1986). Paul Mockapetris's first DNS had two mail records, MD and MF, and Partridge found that a name with both could loop mail or lose it. Mockapetris then proposed a single record, and the specification shrank to about half [Partridge2008].

A domain without MX records gets an implicit MX that points to its own address records (RFC 5321, Section 5.1). For domains that accept no mail, RFC 7505 added the null MX, MX 0 ..

Why is STARTTLS so easy to strip?

Between relays it is opportunistic by default. A public MX must not require TLS, or mail from servers without it would stop (RFC 3207, Section 4). A sender must still refuse clear text for a domain with signed TLSA records (RFC 7672, Section 2.2.3) or an MTA-STS policy in enforce mode (RFC 8461, Section 5). RFC 3207, Section 6 names the weakness: an attacker deletes the 250 STARTTLS response.

In April 2015 Durumeric and colleagues found 41,405 SMTP servers whose STARTTLS command or keyword arrived corrupted in the style of Cisco's SMTP inspection, which overwrites the command with X characters. In seven countries more than 20 percent of inbound Gmail messages arrived in clear text because of network attackers [Durumeric2015].

Who may send mail for example.org?

SPF answers that for the envelope. example.org publishes v=spf1 ip4:198.51.100.25 ip6:2001:db8:a000:25::25 -all, and the receiver checks the connecting address against it before the content arrives. An evaluation may use at most 10 terms that need DNS queries (RFC 7208, Section 4.6.4).

A forwarder that relays from its own address and keeps Sam's MAIL FROM breaks it, and one that rewrites MAIL FROM passes SPF for its own domain instead (RFC 7208, Appendix D). Nothing in SPF requires the domains in MAIL FROM and From: to match.

What does DMARC add, and what changed in 2026?

It ties SPF and DKIM to the From: domain, the one identifier users see. DMARC passes when SPF or DKIM passes for a domain aligned with that Author Domain, by default one with the same Organizational Domain (RFC 9989, Section 4.4 and Section 4.7).

In May 2026 RFC 9989 replaced the Informational RFC 7489, and a DNS Tree Walk of at most eight queries replaced the Public Suffix List (RFC 9989, Section 4.10). RFC 9989, Section 7.4 reverses the old advice to receivers: they MUST NOT reject on p=reject alone, and without other evidence they must treat the mail as quarantine.

Why do mailing lists break all of this?

A list is a new sender that reuses the author's From:. ops@lists.example.com adds [ops] to the subject and a footer, and relays the copy from its own address and bounce address. The footer breaks Sam's bh=, and SPF passes for lists.example.com, which is not aligned with example.org. Nobody forged anything.

In April 2014 Yahoo published p=reject for yahoo.com over a weekend. On 7 April John Levine wrote that Yahoo had broken "every mailing list in the world" [Levine2014]. Twelve years later he is one of the two editors of RFC 9989.

laptopsmtp.example.orgexample.net mailKim's client submission, port 465relay, port 25IMAP or JMAPthe message
From the book: The constructed mail path and the protocol on each leg

The book keeps asking

This chapter has 5,493 words and 16 questions. These 9 are answered only in the book and the audiobook.

  • Why does mail leave the packet's path?
  • What did SMTP replace?
  • How did a 1982 protocol learn new tricks?
  • How does a photo travel through a seven-bit protocol?
  • Why does the laptop not connect to port 25?
  • How can a sender insist on TLS?
  • What does a DKIM signature sign?
  • How does the message reach Kim's screen?
  • Who writes the rules for mail now?

Open the sources

  • RFC 5321 Simple Mail Transfer Protocol 2008, Draft Standard
  • RFC 5322 Internet Message Format 2008, Draft Standard
  • RFC 2045 Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies 1996, Draft Standard
  • RFC 6376 DomainKeys Identified Mail (DKIM) Signatures 2011, Internet Standard, STD 76
  • RFC 7208 Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Version 1 2014, Proposed Standard
  • RFC 9989 Domain-Based Message Authentication, Reporting, and Conformance (DMARC) 2026, Proposed Standard
  • RFC 8461 SMTP MTA Strict Transport Security (MTA-STS) 2018, Proposed Standard
  • [Partridge2008] The Technical Development of Internet Email. IEEE Annals of the History of Computing, Vol. 30, No. 2, pp. 3-29 2008, paid

All 82 documents this chapter cites, each with a link to its publisher and a copy kept here.

Applications, chapter 33 of 36

Time, Shells, and Files: NTP, SSH, Telnet, and FTP

The Whole Path, chapter 34 of 36

Measuring and Debugging the Path

The Whole Path, chapter 35 of 36

The Whole Journey, Byte by Byte

The Whole Path, chapter 36 of 36

Ossification and What Comes Next

You have reached the server. The book goes further.

Everything on this site is a short version. Follow the Packet is the long one: 36 chapters and about 280,000 words, with every protocol fact traced to the section of the standard that defines it, every byte dump built by a script you can run, and a directory of more than a thousand cited documents. It comes as a printable book and as an audiobook.

Hear how chapter 1 opens. 70 seconds, narrated by a synthetic voice.

Get the book or the audiobook Read the start of chapter 1 Browse every source

Cover of Follow the Packet: How the Internet Works, Layer by Layer, from ARPANET to QUIC, by Wolfgang Kerschbaumer

The signup uses double opt-in. Every message includes an unsubscribe link.

Published by Sysinit Press. The public addresses, AS numbers and names of the scenario come from ranges reserved for documentation, and the home network uses private addresses, so the site describes no real network. RFC texts are copied unchanged from the RFC Editor.