🎧 [Listen] The Mail Infrastructure Series, Fully Recapped
This article is an audio-learning recap for anyone who’s already read all seventeen articles in the Mail Infrastructure series. Use your browser’s or phone’s text-to-speech feature and let it play in the background during a commute or while doing chores. There are no diagrams, tables, or code here — just spoken-style prose, stitching the whole series back together into a single, continuous thread.
The series started with what migrating mail from an on-premises Exchange Server to M365, Exchange Online, actually means as concrete work — which specific pieces get switched over. It also covered how a mail address’s domain relates to a website’s domain.
Next came the fundamentals of a mail server. Where Exchange handles both the MTA role and mailbox storage in a single product, the open-source world splits these across multiple pieces of software, Postfix and Dovecot, under a division of labor called MTA, MDA, and MUA. We also organized the difference between the two protocols involved: SMTP, handling transfer between mail servers, and IMAP, handling retrieval from a mailbox.
Then came the hands-on of actually installing Postfix and Dovecot, and sending and receiving mail by typing raw SMTP and IMAP commands over telnet by hand. You confirmed with your own hands an unglamorous but easy-to-miss spec: after the DATA command, the end of the body has to be marked with a line containing a single period.
From here, the series moved into more advanced territory. First, the three mechanisms SPF, DKIM, and DMARC. SMTP has a structural weakness — it lets a sender’s domain be spoofed in the first place. SPF verifies whether the sending IP address is legitimate, and DKIM verifies whether the body and headers were tampered with along the way, each independently. DMARC then combines those two results with alignment — matching against the From header — letting the sending domain’s own owner declare what should happen on failure.
Next, we dug one layer deeper into that alignment itself. SPF and DKIM each authenticate an independent domain — the envelope-From domain and the signing domain respectively — but what a recipient actually sees is the domain in the visible From header. Alignment is the check, one layer above that, of whether the domain SPF or DKIM authenticated matches that From header’s domain. And don’t forget: DMARC passes on an OR condition — either SPF or DKIM being aligned is enough. We also covered the pitfall where SPF shows “pass” when sending through an ESP, yet DMARC still fails because that domain isn’t aligned with the From header.
Next came an easily overlooked weakness in SPF, DKIM, and DMARC. Passing through a mailing list or a forwarding rule changes the source IP to the list server’s own, and modifies the body too (adding a footer, and similar), so even a legitimate sender’s email structurally fails both SPF and DKIM. ARC, Authenticated Received Chain, addresses this by having the forwarder itself record the original authentication results observed at receipt, sign them, and hand them off to the next destination. That said, don’t forget the caveat: whether that record actually gets trusted is up to the final receiving mail server’s own policy, and configuring ARC alone never automatically rescues every forwarded email.
Next came Google’s and Yahoo’s bulk sender requirements. In 2024, any bulk sender pushing 5,000 or more emails a day got hit with a bundled set of mandatory requirements: SPF/DKIM/DMARC authentication, RFC 8058’s one-click unsubscribe header, and a spam complaint rate under 0.3%. SPF/DKIM/DMARC tended to get understood mostly as anti-spoofing measures, but their standing has shifted into a mandatory precondition for reaching the inbox at all. And don’t forget: once classified as a “bulk sender,” that classification stays permanent, even after you later reduce your sending volume.
Next came SMTP smuggling. It abuses a disagreement between the sending and receiving MTA over a message’s end-of-data sequence, hiding a second, sender-forged message inside one legitimate message. Since the outer envelope passes SPF, DKIM, and DMARC entirely, the forged message hidden inside reaches the inbox with no warning. It’s been confirmed to actually succeed against several major MTAs — Postfix, Sendmail, and Exim — and don’t forget: it carries the exact same structural problem as HTTP request smuggling, covered in the Load Balancing Department.
Next came PTR records and FCrDNS. Where SPF, DKIM, and DMARC were domain-level authentication, a PTR record derives a hostname from the sending IP address through a reverse lookup, and a sender with none at all gets treated as a typical characteristic of spam, becoming a major factor in connection rejection or spam classification. FCrDNS then takes the hostname from that reverse lookup and forward-looks it up again, confirming a stricter two-stage check: whether it matches the original IP address. And don’t forget: PTR/FCrDNS is an identity check on the IP address itself, while SPF/DKIM/DMARC is an identity check on the domain — an entirely separate, independent layer of verification.
Next came mail queues and bounces. Even if a sent email doesn’t arrive right away, Postfix keeps it in the queue and retries at intervals. A leading digit of 4 on the SMTP response code means a temporary error, while 5 means a permanent one, and that distinction decides whether Postfix keeps retrying or gives up and sends a bounce email back to the sender. We also touched on a small but important design detail: a bounce email’s own sender address is deliberately left empty, to prevent an infinite chain.
Then came encryption in SMTP. SMTP was a protocol never designed with encryption in mind to begin with. STARTTLS, a mechanism for upgrading an existing plaintext connection into an encrypted one after the fact, was the answer to that historical constraint. But a weakness remains — opportunistic encryption still sends in plaintext if the other side doesn’t support it. MTA-STS, a relatively recent mechanism, reinforces that weakness by combining DNS and HTTPS.
Next came S/MIME, an entirely different layer of encryption from STARTTLS. What STARTTLS encrypts is only ever the server-to-server “path,” never the “body.” Even when STARTTLS works perfectly, a relaying mail server’s operator can read the decrypted body in plain sight. S/MIME was a mechanism that uses the sender’s private key and the recipient’s public key to encrypt the body itself, end to end. Don’t forget, though: some headers, like the subject line, stay outside S/MIME’s scope of encryption and get sent as plaintext — so STARTTLS and S/MIME end up in a relationship where each covers what the other can’t.
Next came DANE, another answer carrying an entirely different trust model from MTA-STS. Where MTA-STS trusted the existing CA (certificate authority) system as its foundation, DANE trusted DNSSEC instead, pinning the certificate itself directly in DNS via a TLSA record. DANE carried complete dependence on DNSSEC, while MTA-STS carried a lack of protection during the first contact — different weaknesses — which is exactly why deploying both together is realistically recommended. Don’t forget the perspective of noticing that fundamental difference in who you trust.
The final article put the SPF, DKIM, and DMARC lecture into practice, hands-on. You actually published an SPF record to DNS and confirmed mail from a sender outside its range actually getting rejected. You also confirmed that wiring in OpenDKIM automatically attaches a digital-signature header to outgoing mail. The understanding that SPF is receiving-side and DKIM is sending-side — an asymmetric division of roles — took shape here as an actual, working configuration.
From here, the series moved into hands-on labs, actually building things by hand. First, virtual domains. You actually built a virtual alias domain setup, letting a single Postfix server accept mail for multiple different domains at once. You felt the design firsthand — no need for a server per domain, and destination resolution cleanly decoupled from creating a real Unix user account.
The final article was a hands-on that deliberately reproduced a dangerous state, an open relay. Deliberately loosening smtpd_relay_restrictions put your own server into a state of unconditionally relaying traffic between two third parties, unrelated to either the sender or the recipient. Putting reject_unauth_destination back in its correct position confirmed you could prevent that dangerous state. You also touched on a practical caveat: the classic real-world cause of becoming an open relay without noticing isn’t a deliberate misconfiguration — it’s letting the range of mynetworks get too broad.
And the seventeenth article wasn’t like the others — it never taught a single new technique. Instead, under the setup of a fictional corporate group, KoiKoi Holdings, migrating its subsidiaries’ separately contracted mail services into a setup centrally managed on one server, you designed, yourself, a single integrated mail infrastructure combining everything you’d learned separately up to that point: building Postfix/Dovecot, virtual domains, SPF/DKIM/DMARC, STARTTLS, open-relay defense, and bounce handling. Following a fixed procedure and designing from requirements are genuinely different skills, and finishing every individual hands-on doesn’t make you immediately effective in real work without experience combining them into one coherent infrastructure.
Looking back across all seventeen articles, one consistent pattern emerges. The SMTP protocol was originally designed on a kind of good-faith assumption — sender spoofing, eavesdropping, and relaying between unrelated third parties were never part of the original picture. SPF, DKIM, DMARC, the alignment check one layer above what DMARC actually looks at, ARC’s compensation for the forwarding problem, Google’s and Yahoo’s bulk sender requirements reshaping their own standing, SMTP smuggling abusing a message-boundary interpretation mismatch, PTR/FCrDNS’s identity check on the IP address itself, STARTTLS, MTA-STS, DANE as another answer built on an entirely different trust model, S/MIME’s end-to-end encryption of the body itself, the settings behind virtual domains and open-relay defense, and the whole mail infrastructure integrated in the capstone are all mechanisms for trust and safety, layered on top of that good-faith protocol after the fact. The habit this series builds isn’t being satisfied on the surface with “the mail got sent, the mail arrived” — it’s understanding which mechanism is compensating for which weakness, and how. That’s the perspective a top-1% engineer carries away from this series. And that’s the recap of the Mail Infrastructure series, complete.