Email was designed in an era when everyone on the network knew everyone
else. The protocol that moves mail between servers, SMTP, will happily
accept a message that says From: [email protected] from any machine
that asks nicely. Nothing in the original design checks that the sender
has anything to do with that domain.
SPF, DKIM and DMARC are the three layers that were bolted on later to fix this. We run an email forwarding service, so we deal with all three every day, from both sides: as a receiver of mail that we pass on, and as a sender of our own messages. This article explains what each one does, where it breaks, and what none of them can do.
The problem: the From line is just text
An email has two sender addresses, and people often mix them up:
- The envelope sender (also called the return path or
MAIL FROM) is given during the SMTP conversation. It is where bounces go. Recipients rarely see it. - The header From is the address your mail app shows. It is just a header the sender typed.
Anyone can set either to anything. That is how phishing mails pretend to be your bank, and how spammers send junk that looks like it came from you. The three standards below let a receiving server check whether the sender was actually allowed to use a domain.
SPF: which servers may send for this domain
SPF (Sender Policy Framework) is a TXT record in DNS that lists the servers allowed to send mail for a domain. The receiving server looks at the envelope sender’s domain, fetches its SPF record and checks whether the connecting IP address is on the list.
| |
Reading it from left to right:
v=spf1marks the record as SPF.ip4:203.0.113.10allows one specific server.include:_spf.mailhost.examplepulls in the list of a mail provider.-allsays: everything else must fail.
The last term matters. -all is a hard fail: mail from any other server
should be rejected. ~all is a soft fail: it is suspicious but may still
be accepted, usually delivered to spam. Many domains start with ~all
while they are still finding all of their sending systems, and move to
-all once they are sure.
SPF has two well known limitations:
- The 10 lookup limit. Every
include,a,mxandredirectcosts a DNS lookup, and a record may trigger at most 10 in total. Go over and receivers return a permanent error, so your mail can fail even though the record looks fine. Companies that use many mail services run into this a lot. - It breaks on forwarding. SPF checks the IP address of the server that hands over the message. When we forward a message to your inbox, the connecting server is ours, not the original sender’s, so an SPF check against the original domain would fail. Forwarders work around this by sending under their own envelope domain, which passes SPF but no longer matches the original From address. This is not a bug in SPF, it is how it works. It is also why SPF alone can never be the whole story.
DKIM: a signature that travels with the message
DKIM (DomainKeys Identified Mail) takes a different approach. The sending server signs the message with a private key. The signature goes into a header, and the matching public key is published in DNS. Anyone can verify that the message was signed by someone who holds the key for that domain and that the signed parts were not changed on the way.
A signature header looks like this (shortened):
| |
The two fields to know are d=, the signing domain, and s=, the
selector. The selector lets a domain publish several keys at once, for
example one per mail service, or a new one while the old one is rotated
out. The public key lives at <selector>._domainkey.<domain>:
| |
Because the signature is part of the message rather than tied to the connecting server, DKIM mostly survives forwarding. It fails only when a forwarder changes something that was signed, such as the subject line or the body. Mailing lists that add a footer are the classic case. A forwarder that passes the message through untouched keeps the signature valid.
DMARC: tying it to the address people see
SPF and DKIM each prove something, but neither says anything about the From address a human reads. A spammer can pass SPF for their own domain while showing your domain in the From line. DMARC closes that gap with two ideas.
Alignment. DMARC requires that the domain that passed SPF or DKIM matches the domain in the visible From header. One aligned pass is enough.
Policy. The domain owner tells receivers what to do with mail that
fails: nothing special (none), put it in spam (quarantine) or refuse it
(reject). The record lives at _dmarc:
| |
The rua tag is the part that makes DMARC practical. Receivers send
aggregate reports to that address, usually daily, showing which servers
sent mail using your domain and whether it passed. Before DMARC, most
domain owners had no idea who was sending in their name.
The sensible way to roll it out is in stages:
- Publish
p=nonewith aruaaddress and collect reports for a few weeks. Nothing is blocked yet. - Fix every legitimate sender that fails: the newsletter tool, the invoicing system, the helpdesk.
- Move to
p=quarantine, optionally withpct=25to apply it to a quarter of failing mail first, then increase. - Move to
p=rejectonce the reports are clean.
Jumping straight to reject is the classic way to lose your own invoices.
ARC: a note for forwarders
Forwarding is where all of this gets awkward, and since forwarding is our business we care about it. SPF fails after a forward, and DKIM fails if the message was modified. If the original domain has a strict DMARC policy, the forwarded message can end up rejected for no fault of the sender or the recipient.
ARC (Authenticated Received Chain) is an answer. Each intermediary that handles the message records the authentication results it saw, and signs that record. The final receiver can then see that the message passed SPF and DKIM when it arrived at the forwarder, even though the checks fail now. ARC does not force a receiver to trust anything. It gives receivers that trust a particular forwarder the information to make a better decision. Support is growing, but uneven.
What these standards do not stop
It is tempting to think that “SPF, DKIM and DMARC all pass” means “safe”. It does not. They answer one narrow question: was this message really sent with the authority of the domain in the From line? They do not tell you whether that domain deserves your trust.
- Lookalike domains.
examp1e.comorexample-support.comcan have perfect SPF, DKIM and DMARC. The mail is fully authenticated, and still a scam. - Spammers who authenticate their own domains. Registering a domain and setting up all three records takes minutes. Plenty of junk mail passes every check.
- Compromised accounts. If an attacker logs in to a real mailbox, the mail they send is signed and aligned like any other.
- Content. Authentication says nothing about what the message asks you to do.
So reputation and content filtering still matter. Receiving servers weigh how a sender has behaved in the past, how many recipients complain and how many addresses bounce.
We learned the sender side the hard way
Our own records were in order, and it did not save us. A forwarding service passes on whatever arrives at its aliases, and some of what arrived was spam. On top of that, verification emails went out to addresses that were mistyped or did not exist, and those bounced. To our email provider, all of it looked like mail sent by us. It blocked our sending entirely, including the messages people need to sign up.
We have since changed a lot. Incoming mail that fails the SPF, DKIM and DMARC checks described above, or that looks like spam, is refused instead of forwarded. Addresses are checked before we send anything to them. Bounces and complaints pause delivery to that address automatically. And forwarded mail now travels separately from our own account emails, so a problem in one cannot take down the other.
The lesson is that authentication proves who you are, and reputation decides whether anyone listens. And as a forwarder, your reputation includes every message you pass on.
What you can do as an individual
You do not control the DNS of the people who email you, but you can still reduce what reaches you.
Put a filter in front of your mailbox. A spam filter gateway such as xQmail is a Dutch service that sits in front of your mailbox. You change your domain’s MX records so that mail arrives at the filter first. It checks the mail, including the authentication results described above, quarantines what looks suspicious and passes the rest on. It works with Microsoft 365 and Google Workspace. This is aimed at people with their own domain, and it adds a layer that does not depend on what your mail provider catches.
Use more than one address. Every site you sign up to gets your address, and addresses leak. If you use a different alias per service, a leaked or abused address can be switched off without touching your real inbox. That is what our email forwarding does: aliases forward to your real address and you can disable any of them at any time.
Be sceptical of “passes all checks”. A message from a perfectly authenticated domain can still be a scam. Look at the actual domain, not the display name, and check where links lead before you click.
A short checklist for your own domain
- Publish an SPF record that ends in
-all(or~allwhile you are still testing) and stays under 10 lookups. - Enable DKIM signing at every service that sends as you.
- Publish DMARC with
p=noneand aruaaddress, read the reports, then tighten the policy step by step. - If you run a forwarder, look into ARC.
- Do not forget the unglamorous part: watch bounces and complaints, because that is what reputation is made of.
