SPF vs DKIM vs DMARC: what's the difference?
SPF, DKIM and DMARC are three records in your domain’s DNS that work together to stop other people sending email as your business. SPF lists the servers allowed to send for your domain. DKIM adds a signature that proves a message came from your domain and wasn’t changed on the way. DMARC ties the two together and tells the receiving server what to do with a message that fails.
You need all three. Here’s what each one does, what the records look like, and the order to turn them on.
What each one does
Picture a letter. SPF is the list of couriers you’ve approved. DKIM is the wax seal on the envelope. DMARC is your instruction for what to do with a letter that has neither: deliver it, set it aside, or throw it out.
SPF (Sender Policy Framework) is a list of the mail servers and services allowed to send for your domain. The receiving server looks up your list and checks whether the sending server is on it. SPF checks the hidden “envelope” sender, not the From address people see. That gap is why SPF alone doesn’t stop a convincing fake.
DKIM (DomainKeys Identified Mail) signs each outgoing message with a private key held by your email provider. The matching public key sits in your DNS. The receiving server uses it to check the signature. If it checks out, the message really was signed by that domain and the signed parts haven’t been altered.
DMARC is the rule that connects them. It asks one question: did SPF or DKIM pass, and does the domain that passed match the From address the reader sees? That match is called alignment. DMARC also lets you pick a policy for failures, and it sends you reports about who is sending as you.
How they work together
When a message arrives, the receiving server runs the SPF and DKIM checks, then looks up your DMARC record. The message passes DMARC if at least one of the two passes and lines up with the From domain. It doesn’t need both.
That’s why having both matters. SPF often breaks when a message is forwarded, because the forwarding server isn’t on your list. A DKIM signature usually survives forwarding, so DMARC can still pass. Going the other way, DKIM can break if a mailing list changes the message, and SPF can still pass.
What the records look like
All three are text (TXT) records in DNS. These examples use example.com and placeholder values.
SPF lives on your main domain:
example.com. TXT "v=spf1 include:spf.protection.outlook.com include:_spf.crm.example.net -all"
Each include: approves a sending service. The -all at the end means “reject anything not listed”. ~all is a softer version: “treat anything else as suspicious”.
DKIM lives under a “selector” name your provider picks:
selector1._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqh...(long public key)"
DMARC lives at _dmarc:
_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"
p= is the policy. rua= is where the daily summary reports go.
Why p=none isn’t protection
p=none tells receivers to take no action on messages that fail. It’s a monitoring setting. Spoofed email that fails DMARC is still delivered as normal, so a domain at p=none can still be impersonated.
It’s the right place to start, because it shows you who sends mail as you before you block anything. It’s the wrong place to stay. Protection begins at p=quarantine (failing mail goes to spam) and is complete at p=reject (failing mail is refused).
A safe order to roll it out
Going straight to p=reject is how businesses end up with invoices that never arrive. Go in this order instead.
- List everything that sends email as you. Your mailbox provider, plus your CRM, invoicing tool, newsletter service, helpdesk, website forms, and any scanners or printers that email.
- Set up SPF and DKIM for each of them, so they pass and match your domain.
- Publish DMARC at
p=nonewith arua=address. Let it run and read the reports. They arrive as XML, so use a DMARC report reader to turn them into a list. Watch for two things: a service you forgot that’s failing, and senders you don’t recognize. - Fix what’s failing, then move to
p=quarantine. Keep watching the reports. If a real sender starts failing, you’ll see it here, and the damage is a message in spam, not a message lost. You can use thepct=tag to apply the policy to a share of failing mail first. - Move to
p=rejectonce the reports are clean and you’re confident every real sender passes.
Common mistakes
More than one SPF record. A domain must have exactly one SPF record. Two records is an error, and receivers may ignore SPF altogether. When a service tells you to “add this SPF record”, merge it into the one you have by adding its include:.
Going over the 10-lookup limit. SPF allows at most 10 DNS lookups while it’s being checked. Each include: counts, and so do the lookups inside each include. Go past 10 and SPF returns an error. Remove services you no longer use before you add new ones.
Forgetting third-party senders. The CRM, the invoicing tool and the newsletter service all send mail with your name on it. If they aren’t in your SPF and signing with DKIM, they fail DMARC the day you start enforcing it. Most services let you sign with your own domain. Turn that on.
Leaving unused domains open. If you own a domain that never sends email, publish v=spf1 -all and a DMARC policy of p=reject. Parked domains are easy to spoof.
Microsoft 365 and Google Workspace
Both give you the pieces, but neither publishes your DMARC record for you.
- Microsoft 365. Add Microsoft’s SPF include (
include:spf.protection.outlook.com) to your one SPF record. Turn on DKIM signing for your custom domain in the admin portal. Microsoft gives you two CNAME records to publish. Then add your DMARC record in DNS. - Google Workspace. Add Google’s SPF include (
include:_spf.google.com). Generate a DKIM key in the Admin console, publish the TXT record it gives you, and then start authentication. Then add your DMARC record in DNS.
Since February 2024, Google and Yahoo have also required senders of bulk email to their users (more than 5,000 messages a day) to authenticate with SPF and DKIM and to publish a DMARC record. Most small businesses send far less. The same records still help your mail reach the inbox.
Check yours, then close the gaps
Our free domain check reads your records and tells you in seconds what’s missing. For the bigger picture, our report on who can send email as you walks through the fix step by step.
Records stop people sending as your exact domain. They don’t stop a lookalike domain, or a convincing message that reaches someone’s inbox some other way. Teaching your staff to spot those is the other half, and Shiftskill’s spoofed email training covers it.
Need a hand?
If someone is already sending email as you, start with our incident response service. If you’d rather set this up once and have it done right, we’ll work through your senders with you.
Stay secure,
Luke Stephenson
Want your SPF, DKIM and DMARC set up properly, without breaking your invoices? Tell us which email system you use and we'll help you work out where to start.