The problem
Email was designed without proof of sender. The From line is just text: anyone can write ceo@example.com there. Phishing relies on exactly that. Three records published in the sender's DNS let a receiving server check a message instead of trusting it.
An email actually carries two sender addresses:
The envelope sender (also called Return-Path or bounce address) is used by the servers to deliver the message and to return bounces. Readers rarely see it.
The From address is what the reader sees in the mail app.
They can differ, for example when a newsletter service sends on a company's behalf. Keep the two apart: SPF checks one, DMARC protects the other.
SPF: which servers may send
SPF (Sender Policy Framework, RFC 7208) is a TXT record on the domain that lists the servers allowed to send its mail.
example.com. TXT "v=spf1 include:_spf.mailprovider.example ip4:203.0.113.10 ~all"include:adds the servers of a mail provider.ip4:allows one address, here a company's own server.~allsays: anything else is suspicious (soft fail).-allsays: anything else fails (hard fail), and many receivers then refuse it.
The check uses the envelope sender (the Return-Path), not the visible From line. SPF also allows at most 10 DNS lookups; a record with more breaks. A domain may publish only one SPF record.
DKIM: a signature on the message
DKIM (DomainKeys Identified Mail, RFC 6376) signs each message. The sending server adds a DKIM-Signature header; the matching public key sits in DNS under a selector.
mail2026._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqh...IDAQAB"The signature names its domain (d=example.com) and selector (s=mail2026). If the message was changed on the way, the signature no longer verifies. Unlike SPF, DKIM survives forwarding, because it travels with the message instead of depending on the server that delivers it. Selectors let a domain use several keys at once, for example one per sending service, and replace old keys without a break.
DMARC: what to do when checks fail
DMARC (Domain-based Message Authentication, Reporting and Conformance) ties the two to the visible From domain and tells receivers what the owner wants done with failures. It was first described in RFC 7489 in 2015; in 2026 the IETF replaced that with RFC 9989, now on the standards track. Records still start with v=DMARC1, and records written for the old version keep working.
_dmarc.example.com. TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com"A message passes DMARC when SPF or DKIM passes and its domain matches (aligns with) the From domain.
p=noneonly asks for reports,p=quarantineasks to treat failures as spam,p=rejectasks to refuse them.rua=is where receivers send daily summary reports.
Alignment is relaxed by default: bounces.example.com aligns with example.com, because both belong to the same organisation's domain. With strict alignment (aspf=s or adkim=s) the names must be identical.
Follow one message
Fabrikam sends a newsletter with the From address news@fabrikam.example. The newsletter goes out through a mail service, which uses the bounce address bounces@mail.fabrikam.example and signs with DKIM for fabrikam.example. The receiving server:
Looks up the SPF record of
mail.fabrikam.example(the envelope sender's domain) and checks that the sending server's IP address is listed. SPF: pass.Reads the
DKIM-Signatureheader, fetches the public key for the selector from DNS and verifies the signature. DKIM: pass for fabrikam.example.Looks up
_dmarc.fabrikam.exampleand checks alignment: the SPF domainmail.fabrikam.examplealigns in relaxed mode, and the DKIM domain matches exactly. DMARC: pass.Writes the results into the message and moves on to its own spam checks.
Authentication-Results: mx.receiver.example;
spf=pass smtp.mailfrom=mail.fabrikam.example;
dkim=pass header.d=fabrikam.example header.s=news1;
dmarc=pass header.from=fabrikam.exampleNow a forger sends from their own server with From: news@fabrikam.example. Their server is not in Fabrikam's SPF record, and they have no private key to sign with. SPF and DKIM fail for Fabrikam's domain, so DMARC fails, and the receiver applies Fabrikam's policy.
Introducing the records safely
Switching straight to p=reject can block a company's own invoices or support emails. The usual order:
List every service that sends as your domain: the office mail system, the newsletter tool, the shop, the invoicing software, the helpdesk.
Add each one to SPF and keep the record under 10 lookups.
Switch on DKIM for each service, with your own domain in
d=.Publish DMARC with
p=noneand arua=address, then read the reports for a few weeks.Fix whatever the reports show failing, then move to
p=quarantineand later top=reject.
Large mailbox providers now expect this. Since February 2024, Google requires SPF, DKIM and DMARC from anyone sending more than 5,000 messages a day to Gmail addresses, together with alignment, one-click unsubscribe for marketing mail and a low spam rate (Google's sender guidelines). Yahoo and Microsoft (for Outlook.com and Hotmail addresses) have published similar rules.
Common mistakes
Two SPF records. Adding a second
v=spf1record for a new service breaks both. Add the service to the one record instead.Too many lookups. Every
include:can contain further lookups. Above 10, SPF returns an error.A forgotten sender. The invoicing tool was never added, so invoices fail DMARC once the policy is strict.
Going to
p=rejecton day one. Start withp=noneand read the reports.No one reads the reports. A
rua=address that nobody checks wastes the monitoring step.Thinking a pass means the inbox. Authentication proves who sent a message. Whether it is wanted is a separate question, judged by complaints, bounces and content.
Exercise
Use the Mailbox Provider Checker to find who receives email for your school's or university's domain.
Look up its SPF and DMARC records with any DNS lookup tool or
nslookup -type=TXT _dmarc.yourdomainin a terminal.Answer: which policy does the domain publish? What would happen to a forged message with its name in the From line?
Check yourself
1.Which address does SPF check?
2.Why does DKIM usually survive forwarding while SPF does not?
3.What does DMARC need to pass?
4.A company publishes p=none. What does it ask receivers to do with failing messages?
5.A company adds a second TXT record starting with v=spf1 for its new newsletter tool. What happens?
6.In which order should a company introduce the records?
Key terms
Envelope sender: the address the sending servers use for bounces, checked by SPF.
Selector: the label that tells a receiver which DKIM key to fetch.
Alignment: the SPF or DKIM domain matches the From domain.
Policy: the
p=value in DMARC: none, quarantine or reject.Aggregate report: the daily summary a receiver sends to the
rua=address, listing which servers sent mail as the domain and whether it passed.
Practise it with the SPF, DKIM and DMARC check.
