Email security fundamentals: SPF, DKIM and DMARC
What each of the three records checks, why alignment is the piece that ties them together, and the order to deploy them in.
SPF, DKIM and DMARC are three separate mechanisms that only do their job together. Each one answers a different question, each has a gap the others cover, and publishing one without the others leaves a domain that looks configured but is not protected.
The problem they exist to solve
SMTP was designed without authentication. Any server on the internet can open a connection and claim to be sending mail from any domain, and nothing in the original protocol contradicts it. Everything below is an attempt to add that check after the fact, without breaking the mail that already works.
One detail underpins all three, and it is worth getting straight before anything else: a message carries two sender addresses. The envelope sender (also called the return-path or MAIL FROM) is exchanged during the SMTP conversation and is where bounces go. The header From is the address your mail client displays. They are often different, entirely legitimately — a mailing list, a ticketing system or a marketing platform will set its own envelope sender — and that gap is exactly what makes DMARC necessary.
SPF: which servers may send
SPF is a list, published as a TXT record, of the servers authorised to send mail using your domain as the envelope sender.
v=spf1 include:_spf.google.com include:servers.mcsv.net ip4:203.0.113.10 -all
Read left to right: mail from anything Google Workspace sends from, anything Mailchimp sends from, or that one IP
address, passes. -all at the end means everything else fails.
The ending matters more than people expect. -all is a hard fail, ~all a soft fail that
asks receivers to accept but mark, and ?all says nothing at all and makes the whole record
decorative. Start at ~all while you are still finding senders you forgot about; move to
-all once the reports are clean.
SPF has two structural weaknesses. The first is a hard ceiling of ten DNS lookups — exceed it and the record is treated as permanently broken, with no warning from anything that would tell you. The second is that SPF breaks on forwarding: when a message is forwarded, the forwarding server becomes the sender, and it is almost certainly not in your SPF record. Check yours with the SPF record checker.
DKIM: the message has not been altered
DKIM takes a different approach. Instead of listing servers, the sending server signs each message with a private key, and publishes the matching public key in DNS. A receiver fetches the key, verifies the signature, and learns two things: the message genuinely came from somebody holding that key, and the signed parts of it have not been changed in transit.
The public key lives at a name built from a selector:
selector1._domainkey.example.com TXT "v=DKIM1; k=rsa; p=MIGfMA0GCSq..."
The selector is chosen by the sending platform, which is what makes it the fiddly part — you cannot guess it, you
read it out of the s= tag in the DKIM-Signature header of a message you have already sent.
Finding your DKIM selector covers the conventions each platform uses.
The DKIM record checker probes the common ones for you.
Because the signature travels with the message, DKIM survives forwarding where SPF does not — as long as nothing in the path modifies a signed header or the body. Mailing lists that append a footer are the classic exception.
DMARC: tying them to the address people see
Here is the gap. SPF checks the envelope sender. DKIM checks the signing domain. Neither says anything about the header From — the only address your recipient ever looks at. A sender can pass both while displaying somebody else's domain in the From line.
DMARC closes it with a concept called alignment: the domain that passed SPF, or the domain that signed with DKIM, must match the domain in the header From. One of the two has to align. That is what turns two technical checks into a statement about the identity your recipient actually sees.
_dmarc.example.com TXT "v=DMARC1; p=reject; rua=mailto:dmarc@example.com; pct=100"
The policy tag says what a receiver should do with a message that fails: p=none means take no action
but send reports, p=quarantine means treat it as suspicious, p=reject means refuse it
outright. The rua address receives the daily aggregate reports, which are the only view you will ever
get of who is sending as your domain. Check your record with the
DMARC record checker.
How they fit together
| SPF | DKIM | DMARC | |
|---|---|---|---|
| Checks | The sending server | The message contents | The visible From address |
| Against | Envelope sender | Signing domain | Header From |
| Survives forwarding | No | Usually | If either aligns |
| Tells receivers what to do | Loosely | No | Yes |
| Reports back to you | No | No | Yes |
The order to deploy in follows from that table. SPF and DKIM first, because DMARC has nothing to evaluate without
them. Then DMARC at p=none to collect reports while changing nothing. Then, once the reports show
every legitimate sender passing, tighten the policy.
Rolling out DMARC walks through each step, and
reading aggregate reports covers the XML you will start receiving.
What all three together still do not prove
That your mail will be delivered. Authentication is necessary, not sufficient. Reputation, content, complaint rates and list hygiene all weigh on the decision, and a brand new sending domain has no reputation to draw on.
That the sender is trustworthy. A phishing domain can publish perfect SPF, DKIM and DMARC. What these records prove is that the mail genuinely came from whoever controls that domain — not that they deserve your confidence.
That your mail is actually being signed. This one trips people regularly: a valid DKIM record in DNS proves a key is published, not that the platform is currently using it. Only a real message, with a DKIM-Signature header on it, proves that.
Checking where you stand
The email security checker looks at SPF, DKIM, DMARC and MX in one pass and separates errors from warnings, which is usually the fastest way to see which of the three is missing. Reverse DNS is the fourth thing receivers look at and is not covered by any of these records — see reverse DNS and PTR records if you run your own mail server.
More in the guides index.