SPF, DKIM and DMARC
SPF, DKIM and DMARC Explained: How They Work Together
SPF checks the sending server, DKIM checks a signature, and DMARC checks that one of them passed for your From domain and says what to do if not.
On this page
SPF, DKIM and DMARC are three DNS-based checks that let a receiving mail server decide whether a message really comes from the domain it claims. SPF checks whether the sending server is allowed to send for the bounce address's domain, DKIM checks a cryptographic signature added by the sender, and DMARC checks that at least one of those passed for the domain in the visible From address, then tells the receiver what to do if not. You need all three, and they only protect you when they line up with the same domain.
If you just want to know whether yours are set up, run your domain through the SPF, DKIM and DMARC checker. The rest of this page explains what it's checking.
Why email needs authentication at all
SMTP, the protocol that moves email, was designed in the early 1980s for a small network of people who trusted each other. It lets the sender type anything into the From line. Nothing in the protocol stops a server in another country from sending mail "from" billing@example.com.
SPF, DKIM and DMARC were bolted on later, each fixing part of that problem. That history is why they overlap in confusing ways: none of them was designed alongside the others.
The two addresses on every message
To understand any of this, you have to know that every email has two sender addresses:
- The envelope sender, also called the Return-Path or MAIL FROM. It's where bounces go. Recipients don't see it. When you send through an email service provider, it's usually the provider's domain, like
bounce-123@mail.esp-example.net. - The header From, the address recipients actually see, like
news@example.com.
SPF checks the first. DKIM checks whatever domain signed the message. Neither one, on its own, checks the second. That's the gap DMARC fills.
SPF: which servers can send for a domain
SPF (Sender Policy Framework, RFC 7208) is a TXT record listing the servers allowed to send mail using your domain in the envelope sender:
example.com. TXT "v=spf1 include:_spf.google.com include:mail.esp-example.net -all"
When a message arrives, the receiver takes the domain from the Return-Path, looks up its SPF record, and checks whether the connecting IP is on the list. The result is pass, fail, softfail, neutral, none, or one of two errors (temperror and permerror). The -all or ~all at the end says what to do with servers not on the list.
SPF's two big weaknesses:
- It breaks on forwarding. When a message is forwarded, the forwarding server's IP isn't in your record, so SPF fails at the final destination.
- It has a 10 DNS lookup limit. Every
includecosts at least one, nested ones count too, and going over makes SPF return permerror for all your mail. See the SPF 10 DNS lookup limit, or count yours with the SPF lookup counter.
For the full syntax, see What is an SPF record?, and for what each result means, SPF fail, softfail, permerror and temperror.
DKIM: a signature that travels with the message
DKIM (DomainKeys Identified Mail, RFC 6376) has the sending server sign each message with a private key. The signature goes into a DKIM-Signature header, and the matching public key is published in DNS at a name built from a selector and the signing domain:
DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=s1;
h=from:to:subject:date; bh=...; b=...
The receiver reads d=example.com and s=s1, fetches the public key from s1._domainkey.example.com, and checks two things: that the body still matches the body hash (bh=), and that the signed headers still match the signature (b=). If both hold, DKIM passes for example.com.
DKIM's strength is that it survives forwarding, because the signature travels inside the message. Its weakness is that anything that changes the signed content in transit (a footer, a rewritten subject line) breaks it. DKIM fail: body hash did not verify and other causes covers how that happens.
Google requires DKIM keys of at least 1024 bits for mail to personal Gmail accounts and recommends 2048.
DMARC: tying it to the From address
DMARC (RFC 9989, which replaced RFC 7489 in May 2026) is a TXT record at _dmarc.example.com:
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com
It adds the check that matters to recipients: did SPF or DKIM pass for a domain that matches the visible From domain? That match is called alignment. Under the default relaxed mode, the two domains just need the same organizational domain, so a DKIM signature from mail.example.com aligns with a From of example.com.
A message passes DMARC if either:
- SPF passes and the Return-Path domain aligns with the From domain, or
- DKIM passes and the signing domain (
d=) aligns with the From domain.
One is enough. DMARC then does two more things SPF and DKIM can't: it publishes a policy for failing mail (p=none, quarantine or reject; see DMARC policy: none vs quarantine vs reject), and it asks receivers to send you reports on everyone using your domain (see how to read DMARC reports).
For the full explainer, see What is DMARC? and DMARC record syntax and tags.
How the three work together: one message, three checks
Say you send a newsletter through an email service provider, with From: news@example.com. Here are three ways it can come out.
| Setup | SPF | DKIM | DMARC |
|---|---|---|---|
| Provider uses its own Return-Path and its own DKIM domain | pass (esp-example.net) | pass (esp-example.net) | fail: nothing aligned with example.com |
| You set up custom DKIM so the provider signs as example.com | pass (esp-example.net) | pass (example.com) | pass on aligned DKIM |
Custom DKIM plus custom Return-Path at bounce.example.com | pass (bounce.example.com) | pass (example.com) | pass on both |
The first row is the single most common authentication problem there is. Both checks "pass," the provider's dashboard shows green, and DMARC still fails because neither pass was for your domain. If you see it, DMARC fail: why it fails and how to fix it walks through the fix.
The third row is the goal. Aligned DKIM carries you through forwarding; aligned SPF is a backup if a signature breaks.
Where to see the results
Every receiver records its verdict in an Authentication-Results header on the delivered message:
Authentication-Results: mx.google.com;
dkim=pass header.i=@example.com header.s=s1;
spf=pass smtp.mailfrom=bounce.example.com;
dmarc=pass (p=QUARANTINE) header.from=example.com
Send a test message to a mailbox you control, view the original, and find this header. Microsoft adds its own compauth result, which combines these checks with other signals. Paste the whole header block into the email header analyzer if you'd rather not read it by eye, or see how to read an email header.
What the big mailbox providers require
- Google requires all senders to personal Gmail accounts to use SPF or DKIM, and bulk senders (more than 5,000 messages a day) to use SPF, DKIM and DMARC, with the From domain aligned with the SPF or DKIM domain. The DMARC policy can be none.
- Yahoo has essentially the same rules: SPF or DKIM for everyone; SPF, DKIM and a passing DMARC policy of at least p=none for bulk senders.
- Microsoft requires high-volume senders to Outlook.com, Hotmail and Live addresses to pass SPF, DKIM and DMARC, and rejects mail that doesn't with 550 5.7.515.
Missing authentication at Gmail shows up as 550 5.7.26. For the background, see the Gmail and Yahoo bulk sender updates.
What authentication doesn't do
Passing all three proves who sent the message. It doesn't prove the message is wanted. A fully authenticated sender with a dirty list and high complaint rates still lands in spam, and now the reputation damage is pinned firmly to their own domain. Authentication is the entry ticket. Reputation is what gets you to the inbox. If you're authenticated and still in spam, start with why emails go to spam.
A setup checklist
- List every service that sends mail as your domain: email provider, CRM, helpdesk, billing, HR, website forms.
- Publish one SPF record that covers the services using your domain in the envelope sender, under 10 lookups.
- Turn on custom DKIM in every one of those services so each signs with your domain.
- Publish DMARC at
p=nonewith aruaaddress. The DMARC record generator will build it. - Read the reports, fix what fails, then move toward
p=reject.
When to get help
If you've worked through the checklist and something still fails, or your DMARC reports show sources nobody on your team recognizes, it's worth having someone who does this every day take a look.
FAQ
Do I need all three?
Yes, if you send any volume. Bulk senders to Gmail and Yahoo are required to have all three, and without DMARC nothing stops others from using your domain in the From line.
If I have DKIM, do I still need SPF?
Yes. DMARC only needs one aligned pass, but SPF is a required item for bulk senders at Gmail and Yahoo, and it gives you a backup when a DKIM signature breaks in transit.
Why does my email fail DMARC when SPF and DKIM pass?
Because they passed for a different domain, usually your email provider's. Set up custom DKIM so the provider signs with your domain.
Does passing SPF, DKIM and DMARC guarantee the inbox?
No. It proves the mail is really from you. Whether it reaches the inbox depends on your reputation: complaints, engagement, list quality and sending patterns.
Sources
- RFC 7208: Sender Policy Framework (SPF)
- RFC 6376: DomainKeys Identified Mail (DKIM) Signatures
- RFC 9989: Domain-Based Message Authentication, Reporting, and Conformance (DMARC)
- Google: Email sender guidelines
- Yahoo Sender Hub: Sender best practices
- Microsoft Learn: Anti-spam message headers in Microsoft 365
In this section
- Authenticating Every Tool That Sends as Your Domain (Sender Inventory)List every service that sends mail as your domain, then give each one SPF coverage and DKIM signing on your domain so all of them pass DMARC.
- DKIM Fail: Body Hash Did Not Verify, Signature Failed and Other CausesDKIM fails when the message changed after signing (body hash did not verify), the signed headers changed, or the receiver can't find a matching public key.
- DMARC Fail: Why DMARC Fails and How to Fix ItDMARC fails when neither SPF nor DKIM passes for a domain aligned with your From address. Usually a sender lacks custom DKIM. Here's how to find and fix it.
- DMARC Policy: p=none vs quarantine vs reject (and Getting to Enforcement)p=none only monitors, p=quarantine asks receivers to junk failing mail, p=reject asks them to refuse it. Start at none, fix your senders, then tighten.
- DMARC Record Syntax and Tags ExplainedA DMARC record is a TXT record at _dmarc.yourdomain with tags for policy, reporting and alignment. Here's what each tag does and what's changed under DMARCbis.
- DMARC Reports: How to Read Aggregate (rua) and Failure (ruf) ReportsDMARC aggregate reports are daily XML summaries of every IP sending as your domain and whether it passed. Here's how to read them and what to do with them.
- DMARC, SPF and DKIM for Domains That Don't Send Email (Parked Domains)Lock down a domain that never sends email with SPF -all, DMARC p=reject and a null MX. Here are the exact records, the subdomain catch and how to check them.
- From, Return-Path and DKIM d= Domains: Alignment ExplainedDMARC alignment means the From domain matches the domain SPF or DKIM authenticated. Here's how the three domains relate, relaxed vs strict, and how to fix it.
- How to Find Your DKIM Selector (and Fix 'No DKIM Record Found')Your DKIM selector is the s= value in the DKIM-Signature header of a message you sent. Here's how to find it, look up the key, and fix 'no DKIM record found.'
- Multiple SPF Records: Why Two Records Break SPF and How to Merge ThemA domain can have only one SPF record. Publish two and receivers return permerror, so SPF fails for all your mail. Here's how to merge them into one record.
- Someone Is Spoofing My Domain: What to DoIf someone is sending email as your domain, publish DMARC, fix SPF and DKIM for your real senders, then move to p=reject so receivers block the fakes.
- SPF 10 DNS Lookup Limit, Void Lookups and SPF FlatteningSPF allows 10 DNS lookups per check. Go over and receivers return permerror, so SPF fails. Here's what counts, how void lookups work, and how to fix it.
- SPF Fail, Softfail, Permerror and Temperror: What Each MeansSPF fail means the sending IP isn't authorized, softfail means probably not, permerror means your record is broken, and temperror means DNS hiccupped.
- What Is an SPF Record? Syntax, Mechanisms, and -all vs ~allAn SPF record is a DNS TXT record listing the servers allowed to send mail for your domain. Here's how the syntax works and when to use -all or ~all.
- What Is DKIM? Selectors, Keys and Rotation ExplainedDKIM adds a cryptographic signature to each email so receivers can verify which domain sent it and that it wasn't altered. Here's how selectors and keys work.
- What Is DMARC? How It Works, What the Tags Mean, and How to Roll It OutDMARC is a DNS record that tells receivers what to do with mail that fails SPF and DKIM alignment for your domain, and sends you reports on who uses it.
Still stuck?
Some deliverability problems take an experienced eye to untangle. Tell me what you're seeing and I'll tell you what I'd check first. The first 30-minute call is free.