How Email Moves Through MTAs, SMTP, and MIME
A walk through the components, SMTP handshake, SPF/DKIM checks, and MIME encodings that carry an email across servers, plus the limits of TLS in transit.
Components and retry logic
An email passes through several named components on the way to a recipient: the sender’s MUA, a submitting MSA, the sending MTA, the receiving MTA, a receiving LDA and message store, then the receiver’s MUA. They may share machines or programs, but separating the steps helps. The MUA is user-facing; the MSA checks a password before handing off to the MTA; the MTA talks to other mail servers; the LDA stores the message until the recipient reads it. This split emerged around 1980, when many organizations had one server, maintenance was a full-time job, updates often meant days of downtime, and a well-connected machine might have a dedicated single-digit megabit/second link that worked half the time. If the recipient’s server is down, the sending MTA saves the message and retries later. Most MTAs retry for five days, usually with exponential backoff. The author’s server waits 5 minutes after a first failure and increases the interval to one hour in prolonged outages.
SMTP flow and authentication
MTA-to-MTA delivery uses SMTP. Before sending, the sender looks up the recipient domain’s MX record; the number is a priority, smaller means higher. The sender then connects to port 25 and sends HELO, MAIL FROM, RCPT TO, and DATA commands. Each line gets a three-digit response: 200 means success, 300 means carry on, 400 indicates a temporary error to retry later, and 500 means the email should be returned as undeliverable. The message ends with a lone period. Submission usually uses TLS on port 465 with AUTH PLAIN and a base64-encoded password.
Envelope addresses in MAIL FROM and RCPT TO do not have to match the From and To headers; forwarding is the most common cause. A mailing list may set the envelope destination to each member’s address while keeping the original From and To headers for replies. Intermediate systems add Received headers. Base SMTP trusts every sender; anyone can send as anyone else. The first documented spam email in 1978 sold $13 million in computers. SPF later published allowed sending IPs in TXT records; DKIM required a DNS-published key to sign the message. SPF can only verify MAIL FROM, because forwarding changes the source IP. DKIM signatures travel with the message and can verify the original From address shown to users. Big providers also require the sender’s HELO hostname to be consistent with the IP address via forward and reverse DNS, which blocks most residential IPs from direct sending. The author argues this pushes users toward paid relays and that five or so companies control 99% of email.
Message format and MIME
Delivered email headers include Return-Path, Delivered-To, Received, DKIM-Filter, Received-SPF, From, and To. Received headers are prepended and are easier to read backward; they record the source’s HELO name, IP address, RCPT TO, and a timestamp. Header lines should not exceed 78 bytes; longer lines are folded and continuations start with whitespace. MIME multipart/alternative can carry plain text and HTML versions with a random boundary. MIME’s version number has stayed at 1.0 since 1996. Quoted-printable uses an equals sign as the escape character; ‘=3D’ decodes to an equals sign. Stray equals signs or missing characters every about 80 bytes often indicate broken quoted-printable decoding. Base64 is used for binary attachments; the email becomes 33% larger than the attached file. Some MTAs support raw binary, but a conversion to base64 later would break DKIM signing.
TLS and practical limits
Client TLS is much like browser TLS, with a certificate from a certificate authority. MTA connections on port 25 start in plaintext, then the sender issues STARTTLS; self-signed certificates are common, and the goal is mainly to block passive eavesdropping, since an active attacker can strip STARTTLS. Submission uses the dedicated 465 port to avoid password leakage.
The author’s closing notes: the protocols allow five days for delivery, sometimes longer; emails are digital postcards stored and forwarded in plaintext by multiple systems, TLS is not universal and can be stripped, so privacy requires encrypting before sending and having the recipient decrypt. Built-in PGP tools make it too easy to hit reply-all without encrypting and can expose the subject line.