SPF, DKIM and DMARC
From, Return-Path and DKIM d= Domains: Alignment Explained
DMARC 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.
On this page
Alignment is the DMARC rule that ties authentication to the address people actually see. A message passes DMARC only if SPF or DKIM passes and the domain it passed for matches the domain in the From header. SPF checks the Return-Path domain and DKIM checks the d= domain, so either of those has to line up with your From domain.
This is the single most common reason a sender sees "SPF pass, DKIM pass, DMARC fail" and assumes the receiver is broken. Both checks passed. They just passed for somebody else's domain.
The three domains in every message
Every email carries (at least) three domains that can differ from one another:
| Domain | Where it lives | Who sees it | What checks it |
|---|---|---|---|
| From (header From, RFC5322.From) | The From: header | The recipient | DMARC |
| Return-Path (envelope sender, MAIL FROM) | The SMTP envelope, copied into a Return-Path: header on delivery | Almost nobody | SPF |
DKIM d= (signing domain) | The DKIM-Signature: header | Almost nobody | DKIM |
Here's a typical message sent through an email service provider without custom setup:
Return-Path: <bounce-8812@mail.esp.example>
DKIM-Signature: v=1; a=rsa-sha256; d=esp.example; s=s1; ...
From: Example Store <news@example.com>
And the receiver's verdict, in the Authentication-Results header:
Authentication-Results: mx.example.org;
spf=pass smtp.mailfrom=mail.esp.example;
dkim=pass header.d=esp.example;
dmarc=fail header.from=example.com
SPF passed for mail.esp.example. DKIM passed for esp.example. Neither is example.com, so DMARC fails. The header analyzer will pull these three values out of any message for you, and how to read an email header walks through the rest.
How alignment works for each mechanism
SPF alignment
SPF authenticates the envelope sender: the MAIL FROM domain, which ends up in the Return-Path header. The DMARC spec says DMARC uses "the result of SPF authentication of the MAIL FROM identity." SPF aligns when that domain matches the From domain.
The catch is that the Return-Path is where bounces go, so most sending platforms use their own domain by default to process them. That's fine for SPF and useless for alignment. To fix it, you set up a custom Return-Path (often called a custom bounce domain or custom MAIL FROM), usually a subdomain like bounce.example.com pointed at the platform with a CNAME or MX record.
DKIM alignment
DKIM authenticates the domain in the signature's d= tag. DKIM aligns when the d= domain matches the From domain. A message can carry several DKIM signatures, and the spec says one aligned, verifying signature is enough.
Platforms often sign with their own domain by default too. Setting up custom DKIM (the CNAME or TXT records your platform gives you) switches d= to your domain.
Either one is enough
DMARC passes if at least one mechanism passes with an aligned domain. You don't need both. That said, aim for both: SPF breaks when mail is forwarded (the forwarding server's IP isn't in your record), and DKIM can break when something modifies the message in transit. Two aligned passes means one can fail without taking DMARC down with it.
Relaxed vs strict
DMARC lets you choose how close the match has to be, separately for SPF (aspf) and DKIM (adkim):
| Mode | Tag value | Rule | bounce.example.com vs From example.com |
|---|---|---|---|
| Relaxed (default) | r | Same organizational domain | Aligned |
| Strict | s | Exact match | Not aligned |
The organizational domain is, roughly, the registrable domain: example.com for news.mail.example.com, or example.co.uk for shop.example.co.uk. Under relaxed alignment, any subdomain of example.com aligns with any other subdomain of it, and with example.com itself.
Relaxed is the default for both tags, and it's what nearly everyone should use. RFC 9989, the updated DMARC standard, says as much: "nearly all Domain Owners have found relaxed alignment sufficient." Strict alignment mostly causes failures when a team sends from a subdomain without telling anyone. The DMARC record reference covers both tags.
One change in RFC 9989 worth knowing: the organizational domain used to be determined from a public suffix list. RFC 9989 replaces that with a "DNS tree walk" that looks for DMARC records up the domain hierarchy. For ordinary company domains, the answer is the same either way.
Common alignment failures
- The platform's defaults. Most often, you added a new ESP, CRM or helpdesk, verified the From address, and never completed the domain authentication step. SPF and DKIM pass on the vendor's domain. Fix: set up custom DKIM and, if offered, a custom Return-Path.
- Strict alignment with subdomains.
adkim=soraspf=splus a platform signing asmail.example.comwhile the From saysexample.com. Fix: switch to relaxed unless you have a specific reason not to. - Forwarding and mailing lists. SPF fails because a third-party server re-sends the mail. DKIM usually survives plain forwarding but can break if a list adds a footer or changes the subject. Fix: make sure DKIM is aligned, since it's the one that survives.
- A different From domain than you thought. A team sends from
example-mail.comor a regional domain that has none of your authentication. Fix: authenticate that domain separately, or send from the one that's set up.
For more causes and how to diagnose them, see DMARC fail: why it fails and how to fix it.
Why receivers insist on it
SPF and DKIM on their own prove a message came from some domain. They say nothing about whether that domain has anything to do with the brand in the From line. A spammer can pass SPF and DKIM perfectly on their own domain while putting your name in the From. Alignment closes that gap, and it's why DMARC can tell a receiver to reject spoofed mail.
It's also now a requirement at the biggest mailbox providers. Google's sender guidelines for bulk senders (more than 5,000 messages a day to Gmail) say "the domain in the sender's From: header must be aligned with either the SPF domain or the DKIM domain." The same guidelines allow a DMARC policy of p=none, so you can meet the alignment rule before you're ready to enforce. See the Gmail and Yahoo bulk sender requirements for the rest.
How to check your alignment
- Send a real message from each platform to a mailbox you control.
- Open the original message and find
Authentication-Results. - Compare
smtp.mailfromandheader.dwithheader.from. At least one should share your organizational domain (or match exactly, if you use strict). - Look for
dmarc=pass.
To check the records themselves, run your domain through the SPF, DKIM and DMARC checker. For a view across every service sending as your domain, DMARC aggregate reports show SPF and DKIM results, and whether they aligned, per source IP.
When to get help
If your DMARC reports show several sources failing alignment and you can't tell which vendor is which, or you're about to move to p=quarantine or p=reject and want to be sure nothing legitimate breaks, it's worth getting a second opinion first.
FAQ
Why does DMARC fail when SPF and DKIM both pass?
Because they passed for a domain that doesn't match your From domain. Usually the sending platform is using its own Return-Path and DKIM signing domain. Set up custom DKIM (and a custom Return-Path if offered) on that platform.
Do I need both SPF and DKIM to align?
No. DMARC passes if either one passes and aligns. Aligning both is more resilient, since SPF fails on forwarding and DKIM can fail when messages are modified.
Does a subdomain align with my main domain?
Under relaxed alignment, the default, yes: mail.example.com aligns with example.com. Under strict alignment, only an exact match counts.
Is the Return-Path the same as the Reply-To?
No. The Return-Path is where bounces go and what SPF checks. Reply-To is where a person's reply goes. Reply-To plays no part in SPF, DKIM or DMARC.
Sources
Related guides
- 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.
- 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.'
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.