Sub topic 10
Confirming SPF, DKIM and DMARC
This chapter assumes you can edit DNS records, or can ask someone who can, and that you know how to run a test send to a seed list (covered earlier). Authentication is a one-time setup per sending domain. Re-check it before big sends, after changing email providers, and after any DNS change.
What each record proves
Receiving servers use three standards to decide whether a message really comes from the domain in its From address.
- SPF (Sender Policy Framework) is a DNS record listing the servers allowed to send mail for a domain. The receiver checks the sending server's IP address against that list.
- DKIM (DomainKeys Identified Mail) adds a cryptographic signature to each message. The receiver fetches the public key from DNS and checks that the signature matches and the message was not altered.
- DMARC (Domain-based Message Authentication, Reporting and Conformance) tells receivers what to do when checks fail. It passes only if SPF or DKIM passes and the passing domain aligns with the domain in the visible From address.
Alignment is the most common source of confusion. Your provider may send with its own bounce domain, so SPF can pass for that domain while failing alignment with yours. Setting up a custom DKIM signature for your own domain usually fixes this.
Example records
Both records below are published as DNS TXT records. Replace the placeholder names with the values your provider documents.
example.com. IN TXT "v=spf1 include:_spf.mail-provider.example ~all"
_dmarc.example.com. IN TXT "v=DMARC1; p=none; rua=mailto:[email protected]"The SPF record names the provider's servers with include:. The ~all ending marks other senders as a soft fail. The DMARC record uses p=none, which only monitors. The rua address receives aggregate reports showing who sends mail as your domain.
The DKIM public key sits at selector._domainkey.example.com. Your provider chooses the selector name and gives you the record to publish.
Confirming the setup
Query the records from a terminal.
dig +short TXT example.com
dig +short TXT _dmarc.example.com
dig +short TXT selector1._domainkey.example.comThen confirm that a real message passes. Send a test to a Gmail seed address, open the message, and choose Show original. The summary at the top should read SPF: PASS, DKIM: PASS and DMARC: PASS. Check the domain shown next to each result, not only the word PASS. A DKIM pass for your provider's domain does not align with your From address.
Common errors
| Problem | Symptom | Fix |
|---|---|---|
| Two SPF records on one domain | SPF returns a permanent error | Merge them into one record with several `include:` entries |
| More than 10 DNS lookups in SPF | SPF fails intermittently | Remove unused `include:` entries |
| DKIM record not published, or pasted with line breaks | DKIM shows FAIL or NONE | Republish the key exactly as given and wait for DNS to update |
| Passing domain differs from From domain | DMARC fails despite SPF PASS | Enable custom-domain signing at your provider |
| DNS change not yet visible | Old results appear | Wait for the record's TTL to expire, then retest |
Policy choice
Start with p=none and read the reports for a few weeks. This shows every system that sends as your domain, such as a billing tool or a support desk, so you can authenticate them before tightening. Moving to p=quarantine or p=reject before that point can block legitimate mail.
Exercise
A test email shows SPF: PASS, but DMARC: FAIL. The SPF result names the provider's bounce domain, and there is no DKIM signature for your domain. What is the likely cause, and what should you change?
Show answer
DMARC requires a passing check that aligns with the From domain. SPF passed for the provider's bounce domain, which does not match your From domain, and DKIM is not signing as your domain. Set up custom-domain DKIM signing at the provider by publishing the DKIM record it gives you. Then resend the test and confirm that DKIM passes for your own domain.