Lesson 1 of 14 · 16m
The Envelope Is Not the Letter
SMTP uses a separate MAIL FROM envelope that never has to match the From: header your client displays, and every email authentication layer exists because of that split.
What Actually Happens on the Wire
A remote MTA connects to your port 25, says EHLO mta.example.net, then issues a short sequence of commands: MAIL FROM:<billing@example.net>, RCPT TO:<you@yourdomain.org>, DATA, a blob of text, a lone . on its own line, QUIT. Two objects just crossed the connection, and they are not the same thing.
The MAIL FROM and RCPT TO commands are the envelope — the delivery instructions the transport actually uses. The DATA blob starts with a header block — From:, To:, Subject:, Date: — followed by the body. Your mail client renders the header block. It never shows you the envelope. And nothing in the base protocol requires the two to agree.
That split is the design, not a bug. RFC 5321 carries the envelope; RFC 5322 carries the letter. MAIL FROM is where bounces go. From: is meant to name the author for the human reading it. A mailing list legitimately rewrites the envelope to its own bounce handler while leaving From: pointing at the original author — which is mechanically identical to what a phisher does.
The Ports Tell You Who's Talking
Port assignments encode the trust model. Port 25 is inter-MTA relay traffic: server to server, no AUTH, TLS opportunistic if it happens at all. Port 587 is submission: your client to your own MTA, AUTH required, STARTTLS expected. Port 465 is implicit-TLS submission, deprecated in 2000 and then resurrected by RFC 8314 because implicit TLS turned out to be the safer default. When you see mail flow, the first forensic question is which port it entered on — relay and submission have completely different authentication stories.
One more semantics trap: 250 OK from a remote MX means "accepted for a delivery attempt." It does not mean delivered, and it definitely does not mean inboxed. Mail that vanishes between acceptance and the mailbox is an entire industry.
The Mental Model That Gets People Phished
The model almost everyone carries is: the From: header is the sender. It is not. From: "PayPal Security" <alert@pp-security.example> inside DATA is a string the sending program typed. The receiving MTA never compares it against the envelope, and nothing in SMTP authenticates either one. SPF, DKIM, and DMARC exist specifically because the original protocol trusted strings.
This is why business email compromise works at industrial scale. The FBI's IC3 logged $2.9 billion in BEC losses in 2023, and the median phish is embarrassingly plain: From: "Your CEO" <ceo.mailer92@gmail.com> where the display name does all the work. No exploit, no clever encoding. Just a header that was never checked against anything.
The Trust Boundary
The rule that runs the rest of this course: the parts of a message you can trust are the parts your infrastructure wrote. Your MX records the peer's real IP when the TCP connection lands — that topmost Received: line is yours. Your MTA stamps Return-Path: from the envelope's MAIL FROM at final delivery. Your spam filter adds Authentication-Results:. Everything below those lines — other people's Received: headers, Reply-To:, Message-ID:, every X- header — arrived as client-supplied bytes.
When Framing Itself Is the Vulnerability
In December 2023, SEC Consult and researcher Timo Longin disclosed SMTP smuggling: send a DATA payload with non-standard line endings — a bare <LF>, or a <CR><LF>.<LF> termination variant — and certain receiver stacks split it into two messages where the sender's scanner saw one. The receiver applied SPF and DKIM verdicts to the outer message, then delivered an injected second message carrying the first one's credibility. Postfix added smtpd_forbid_bare_newline in response; Cisco Secure Email was among the affected products. Even the boundary between messages is attacker-controlled if the implementation permits it.
Correct Practice
When you evaluate any email control — an SPF record, a DKIM signature, a gateway rule — the first question is which object it binds to: the envelope domain, a d= signing domain, or the From: header. Controls that don't name their object are usually controls that don't do what you assumed. The next three lessons take the triad apart one binding at a time.
Keep reading
Related articles from the SudoSecurity blog.
Self-Hosted Email in 2026: Mailcow vs Mailu vs Stalwart — Which Mail Server Should You Trust?
Self-hosted email in 2026 comes with more choices than ever. This guide compares Mailcow, Mailu, and Stalwart across security, performance, resource usage, scalability, administration, and deliverability to help you choose the right mail server for your needs.
Stalwart 1.0 Says It's the Fastest Mail Server on the Planet. Here Are the Numbers.
After five years, Stalwart hit its first stable release on October 26 with benchmarks claiming it beats Postfix and Dovecot in 35 of 38 head-to-head tests. Every one of those numbers was produced by the vendor.
How to Self-Host Your Own Email Server With Mailcow in 2026 — Complete Setup Guide
How to Self-Host Your Own Email Server With Mailcow in 2026 — Complete Setup Guide Meta Description: Stop letting Google and Microsoft read your email. This guide sets up a complete private email server with Mailcow on a NetCup VPS — DNS, SPF, DKIM, DMARC, TLS, webmail, and mobile clients.
What Self-Hosters Are Ripping Out of Their Stacks in 2026
Self-hosted email is losing to Gmail's hard SMTP rejections. Self-hosted password managers are split down the middle. And self-hosted music is doing the opposite of what you'd expect.