How an e-mail travels

A sent e-mail passes several servers, and on the way they check whether it really comes from who it claims to be. Walk through it step by step.

Use the arrow keys to move between steps. Click a term to see what it means, or any row of the timeline.

Sent

Inside the message

Where the time goes

Times are typical values for illustration, not measurements.

How it works

The mail client hands the message to its server on port 587 with a login. The server signs it with a DKIM key and looks up the MX record of the recipient's domain to find where to deliver it.

Servers talk SMTP, today encrypted with STARTTLS. The receiving server then checks SPF in DNS (may this IP send for the domain?), DKIM (does the signature match?) and DMARC (what to do if not?).

DMARC passes when at least one of SPF and DKIM matches the domain in the From address. That is why forwarded mail passes thanks to DKIM even though SPF fails.

Greylisting temporarily refuses the first message from an unknown sender. A legitimate server retries a few minutes later; spammers often do not. Timings are typical values.

When it helps

  • Understand why e-mails from your website or invoicing land in spam.
  • Explain to colleagues what SPF, DKIM and DMARC are for and why one of them is not enough.
  • Find out why the first e-mail from a new contact arrived ten minutes late.
Glossary 28 terms
Email client
The program or app where you write and read mail: Outlook, Thunderbird, Gmail in the browser, the mail app on your phone.
Spoofing
Sending an email with someone else's address in the From field. It is the basis of phishing. Only SPF, DKIM and DMARC on the domain stop it.
VPS
A rented virtual server. It costs a few euros a month, so an attacker can easily get one and send mail from it.
SMTP
The protocol for sending mail, from client to server and between servers. It is a conversation of commands like EHLO, MAIL FROM, RCPT TO and DATA.
Submission on port 587
The port where a mail server accepts messages from its own users, with a login. Servers talk to each other on port 25.
STARTTLS
A command that switches on encryption in a running SMTP connection. From then on nobody can eavesdrop on the mail between the servers.
DKIM
A digital signature on an email. The sending server signs the message with the domain's key and the recipient checks it with the public key from DNS.
Private key
The secret half of a key pair that only the owner holds. It signs or decrypts. Whoever steals it can pose as the owner.
Hash
A short fingerprint of data. The same data always gives the same hash, the slightest change gives a completely different one. Signatures sign the hash, not the whole message.
MX record
A DNS record that says which server accepts mail for a domain. The number in front is the priority, lower goes first.
DNS
The phone book of the internet. It turns names like example.com into the IP addresses computers understand.
Greylisting
An anti-spam trick: the server temporarily refuses the first message from an unknown sender. Honest servers try again, spam scripts often don't.
SMTP reply code
A three-digit number in a server's reply. 2xx means OK, 4xx a temporary error (try later), 5xx a permanent refusal.
Mail queue
Messages a server hasn't delivered yet. It retries them at intervals, usually for several days, then returns an error to the sender.
EHLO
The opening SMTP greeting in which the sending server introduces itself. The receiving server replies with what it supports, such as STARTTLS.
Envelope
The addresses servers pass with MAIL FROM and RCPT TO. They can differ from the header addresses you see in your mail app.
Forwarding
A server accepts a message and sends it on to another address. It sends from its own IP address, which is why SPF fails at the recipient.
SPF
A list in the domain's DNS of the servers allowed to send mail for it. The recipient compares the sending server's IP address with this list.
TXT record
A DNS record with free text. It is used for SPF, DKIM, DMARC and for proving you own a domain.
IP address
The numeric address of a computer on the internet, such as 203.0.113.10. Routers deliver data by it, like the post delivers by the address on an envelope.
DKIM selector
The name of a specific key, such as mail2026. A domain can have several, and the selector in the signature says which one to look up in DNS.
Public key
The half of a key pair anyone may know. It verifies a signature made with the private key.
DMARC
A domain's instruction to recipients: what to do with mail that fails SPF and DKIM (nothing, spam or reject) and where to send reports.
Alignment
DMARC wants the domain verified by SPF or DKIM to match the domain in the From field the recipient sees.
Spam filter
Rates a message by sender authentication, content, links and history. The score decides between the inbox and spam.
Sender reputation
How recipients treat mail from an IP address and domain: how much gets marked as spam, how many addresses don't exist. It takes months to build.
Authentication-Results header
A header the receiving server adds with the SPF, DKIM and DMARC results. You will find it when you show the original message.
IMAP
The protocol a mail app uses to read mail from the server. Messages stay on the server, so every device shows the same mailbox.

Frequently asked questions

// 01 Why does mail without SPF and DKIM end up in spam?

The receiver cannot verify that an authorised server sent it. Since 2024 Gmail and others penalise unauthenticated mail heavily and reject it from bulk senders.

// 02 Can an attacker send an e-mail with my address?

Technically yes, SMTP does not forbid it. Only DMARC with a quarantine or reject policy stops it, if the domain has one.

// 03 Why does a forwarded e-mail fail SPF?

The forwarding server has a different IP than the one in the sender's SPF. The DKIM signature saves the message, as it survives forwarding as long as the content is unchanged.

QR code for a PayPal donation

Did this save you time?

The tools and simulations are free, ad-free and need no sign-up. If they helped you, you can send a contribution for coffee and new tools.

Donate via PayPal

Need a hand?

I build and maintain web applications in Laravel and PHP. If something on these pages is giving you trouble in a project, get in touch.

Get in touch