SPF, DKIM and DMARC: email authentication explained
How SPF, DKIM and DMARC work together to stop spoofed email, how to read the records, and the most common mistakes.
Email was designed in a time when everyone trusted each other. The original protocol lets any server claim to send mail from any address – which is why phishing mails can appear to come from your bank. SPF, DKIM and DMARC are three DNS-based mechanisms that let a domain owner say which mail is genuine and what receivers should do with the rest. Large providers such as Gmail and Yahoo now require them from bulk senders, and missing records are a common reason for mail ending up in spam.
SPF – which servers may send
SPF (Sender Policy Framework) is a TXT record on the domain that lists the servers allowed to send mail using the domain in the envelope sender (the "Return-Path" address). A typical record looks like this:
v=spf1 include:_spf.google.com include:spf.protection.outlook.com ip4:203.0.113.25 -all
include:pulls in the SPF policy of a service provider, such as Google Workspace or Microsoft 365.ip4:/ip6:list specific addresses, andaandmxallow the domain's own web and mail servers.- The ending says what to do with everything else:
-all(fail),~all(soft fail – accept but mark as suspicious),?all(neutral).+allallows the whole internet and should never be used.
Common SPF mistakes – which webstriker checks for:
- More than one SPF record. A domain must have exactly one TXT record starting with
v=spf1. Two records make SPF fail with a "permerror". Merge them into one. - Too many DNS lookups. Evaluating SPF may trigger at most 10 DNS lookups (each
include,a,mx,existsandredirectcounts, including those inside included records). Many providers' includes contain further includes, so the limit is reached faster than you think. webstriker counts the top-level mechanisms; nested ones come on top. - Forgotten senders. Newsletter tools, CRM systems, web shops and ticket systems often send as your domain. Each needs to be in SPF – or, better, use DKIM with your domain.
DKIM – a signature on every message
DKIM (DomainKeys Identified Mail) lets the sending server sign each message with a private key. The matching public key is published in DNS under a selector: <selector>._domainkey.example.com. The receiver reads the selector from the DKIM-Signature header of the message (the s= tag), fetches the key and verifies that the message has not been changed and really was signed for that domain.
Because the selector name is chosen by the sender, there is no way to list all DKIM keys of a domain. webstriker tries the most common selectors – google for Google Workspace, selector1 and selector2 for Microsoft 365 (these are CNAMEs pointing to Microsoft), k1 for Mailchimp, default, s1/s2 and a few others. If none is found, look at the headers of an email from the domain to find the real selector.
Unlike SPF, a DKIM signature survives forwarding, which makes it the more robust of the two.
DMARC – tying it together and setting a policy
SPF and DKIM on their own have a gap: they validate the envelope sender or the signing domain, which need not match the From address the recipient actually sees. DMARC closes that gap. It requires that at least one of SPF or DKIM passes and is aligned with the domain in the From header. It also lets you tell receivers what to do when a message fails, and where to send reports.
The record lives at _dmarc.example.com:
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com; adkim=r; aspf=r
p=none– monitor only. Nothing is blocked, but you receive reports.p=quarantine– failing mail should be treated as suspicious, typically moved to spam.p=reject– failing mail should be refused. This is the goal, and gives the best protection against spoofing.rua=– where daily aggregate reports are sent. They show which servers send mail as your domain and whether it passes.
A safe way to roll it out
- Publish one correct SPF record that covers all services sending as your domain.
- Enable DKIM signing with your domain in every service that supports it (Microsoft 365, Google Workspace, newsletter tools, and so on).
- Publish DMARC with
p=noneand aruaaddress. Read the reports for a few weeks – a free or paid DMARC report service makes the XML readable. - When all legitimate mail passes, move to
p=quarantine, and later top=reject.
The extras: MTA-STS, TLS-RPT and BIMI
- MTA-STS (
_mta-stsTXT record plus a policy file onhttps://mta-sts.yourdomain/) tells other mail servers to always use encrypted, certificate-checked connections when delivering to you. - TLS-RPT (
_smtp._tls) asks senders to report problems with encrypted delivery. - BIMI (
default._bimi) lets supporting mail clients show your logo next to authenticated mail. It requires DMARC at quarantine or reject.
Run a webstriker lookup on your domain to see all of these in the "Email" section of the report.