Sub topic 10
Confirming SPF, DKIM and DMARC
This chapter assumes you can edit DNS records for your sending domain, or can ask someone who can. It also assumes you know what a From address and a bounce (return-path) address are. You do not need to know how mail servers work internally.
Authentication is a pre-send check because the failure is silent. A campaign with broken authentication looks fine in your platform and in your own inbox. Mailbox providers then route it to spam or reject it, and you see only low opens afterward. Test sends are how you catch this before the full list does.
What each record proves
Three DNS-based mechanisms work together. Each answers a different question.
| Mechanism | Question it answers | Where the record lives | What is checked |
|---|---|---|---|
| SPF | Is this server allowed to send for this domain? | TXT record at the domain | The sending IP against a list of permitted senders |
| DKIM | Was this message signed by the domain and left unaltered? | TXT record at `selector._domainkey.domain` | A cryptographic signature in the message headers |
| DMARC | What should the receiver do if SPF and DKIM fail to align with the visible From domain? | TXT record at `_dmarc.domain` | The policy, plus reporting addresses |
SPF and DKIM are checks. DMARC is a policy that sits on top of them and adds one requirement: alignment.
Alignment
SPF checks the domain in the hidden return-path address (also called the envelope sender or Mail From). DKIM checks the domain in the signature's d= tag. Neither of these is the From address your recipients see. DMARC passes only when at least one of the two checks passes and its domain matches the visible From domain.
This is the most common source of confusion with an email service provider. The provider often sends with its own return-path domain, so SPF passes but does not align with your From domain. If the provider also signs with your domain's DKIM key, DMARC still passes through DKIM. If it signs with its own domain, DMARC fails even though SPF and DKIM both report "pass".
What the records look like
Here are an SPF record and a monitoring-only DMARC record. The names after include: and in the rua address are placeholders. Use the values your email 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 parts that matter:
include:authorizes another domain's published senders, which is how an email service provider is usually added.~allis a soft fail: mail from other sources is suspicious but not rejected.-allis a hard fail. Start with~allunless you are sure every sender is listed.p=nonetells receivers to deliver failing mail but still send you reports.quarantineandrejectenforce.rua=is the address that receives aggregate XML reports. Use a mailbox or a reporting service that can read them.
DKIM records are generated by your provider. It gives you a selector and either a TXT record containing a public key or a CNAME pointing to a key it hosts. You publish it. The provider signs with the matching private key.
Check the DNS before you send
Query the records directly. These commands use dig, which is available on macOS and Linux. On Windows, use nslookup -type=TXT.
dig +short TXT example.com
dig +short TXT _dmarc.example.com
dig +short TXT s1._domainkey.example.com
dig +short CNAME s1._domainkey.example.comReplace s1 with the selector your provider gave you. Check the following:
- The domain has exactly one record starting with
v=spf1. Two SPF records cause a permanent error, and receivers treat SPF as failed. - The SPF record includes your provider's
include:value and every other system that sends as your domain, such as a CRM, a support desk or an invoicing tool. - The DKIM selector returns a key (or a CNAME that resolves). An empty answer means the record is missing or you used the wrong selector.
_dmarcreturns onev=DMARC1record, and theruaaddress is spelled correctly.
DNS changes can take time to spread. If a record you just added does not appear, wait for the TTL (the cache lifetime) to expire before assuming it is wrong.
Check the headers of a real test send
DNS lookups show what you published. They do not show what a receiver concluded about an actual message. For that, send a test to a seed address at a major provider (see the chapter on test sends) and read the headers. In Gmail, open the message, use the three-dot menu and choose "Show original". The summary at the top lists SPF, DKIM and DMARC results. The raw headers contain a line like this:
Authentication-Results: mx.google.com;
dkim=pass [email protected] header.s=s1;
spf=pass [email protected];
dmarc=pass (p=NONE) header.from=example.comRead it field by field:
dkim=pass [email protected]means the signature verified, and the signing domain isexample.com. If this shows the provider's domain instead, DKIM will not align with your From address.spf=pass [email protected]shows the return-path domain that was checked. Compare it with your From domain.dmarc=passis the result you need.header.fromis the visible From domain it was evaluated against.
Send the test through the same sending path as the real campaign. A message sent from your own mail client, or from a different sending stream in the same platform, can pass when the campaign fails, because it may use different servers or keys.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| `spf=permerror` | Two SPF records, or more than 10 DNS lookups | Merge into one record; remove unused `include:` entries |
| `spf=softfail` | Sending IP not in the record | Add the sender's `include:` value |
| `dkim=none` | Provider is not signing, or the message was sent through another route | Enable domain signing in the provider settings |
| `dkim=fail` | Public key in DNS does not match, or a gateway changed the body | Recopy the key; check for footer-appending gateways |
| `spf=pass` and `dkim=pass` but `dmarc=fail` | Neither domain aligns with the From domain | Set up a custom return-path or sign with your own domain |
The 10-lookup limit is worth knowing. SPF allows at most 10 DNS-querying terms (include, a, mx, exists, redirect, and nested ones). Each added service can use several, so a domain with many tools can exceed the limit without anyone noticing.
Long DKIM keys also cause trouble. A 2048-bit key exceeds the 255-character limit of a single DNS string. Most DNS panels split it automatically. If yours does not, the published key is truncated and verification fails.
Choosing a DMARC policy
Start with p=none and read the aggregate reports for a few weeks. The reports show every system sending as your domain, including ones you forgot. Fix those, then move to quarantine and later reject. Jumping straight to reject can block legitimate mail from a tool you did not list.
Pre-send testing does not change your policy. Its job is to confirm that your campaign passes under the policy you already have.
Large mailbox providers now expect this setup. Gmail and Yahoo require SPF, DKIM and at least a DMARC record from bulk senders. In Gmail's case that means senders of roughly 5,000 or more messages a day. Sending without them risks rejection regardless of your content.
What this check cannot tell you
Passing authentication shows that the message is genuinely from you. It does not make the message wanted. A fully authenticated campaign can still land in spam because of poor list quality, high complaint rates or spammy content. The next chapter covers those factors.
Exercise
A test send to your Gmail seed address shows spf=pass [email protected] and dkim=pass [email protected], but dmarc=fail header.from=yourbrand.com. Why does DMARC fail, and what do you change?
Show answer
Both SPF and DKIM passed, but for the provider's domain (esp-mail.example), not your From domain (yourbrand.com), so neither is aligned. DMARC needs at least one aligned pass. In the provider's settings, set up domain authentication so that messages are signed with your own domain's DKIM key (publishing the DKIM record it gives you), or configure a custom return-path on a subdomain of yourbrand.com. Then send a new test and confirm dmarc=pass.
Exercise
dig +short TXT example.com returns two lines that both start with "v=spf1". What happens, and how do you fix it?
Show answer
Receivers treat multiple SPF records as a permanent error (spf=permerror), so SPF fails for the domain. Merge them into a single record by combining all the include: and ip4: terms, ending with one all mechanism, and delete the extra record.