Guides / SPF and DKIM pass but DMARC fails: how alignment works and how to fix it
SPF and DKIM pass but DMARC fails: how alignment works and how to fix it
You open a message's headers and see spf=pass, dkim=pass and then dmarc=fail. That looks like a contradiction, but it isn't. DMARC doesn't only ask whether SPF or DKIM passed. It asks whether they passed for the same domain that's in your From address. That match is called alignment, and it's the most common reason cold email fails DMARC with everything else looking green.
What DMARC actually checks
DMARC (defined in RFC 7489) looks at the domain in the visible From header, the one your recipient sees. A message passes DMARC when at least one of these is true:
- SPF passed, and the domain SPF checked is aligned with the From domain.
- DKIM passed, and the domain in the signature's
d=tag is aligned with the From domain.
So you only need one aligned pass, not both. But a pass for some other domain doesn't count. Gmail's sender guidelines say the same thing: for DMARC, the authenticating domain must match the domain in the From header.
Why SPF can pass for the wrong domain
SPF doesn't check your From address. It checks the envelope sender, also called the Return-Path or MAIL FROM domain, which is where bounces go. Many sending tools and email APIs use their own bounce domain by default, such as a subdomain of the provider.
In that case SPF really does pass, but for the provider's domain, not yours. The header shows spf=pass while DMARC treats it as unaligned. The fix is a custom Return-Path (often called a custom MAIL FROM or bounce domain) on a subdomain of your own domain, which most providers let you set up with a CNAME or MX plus SPF record.
Why DKIM can pass for the wrong domain
DKIM passes when the signature verifies, whatever domain signed it. If you haven't set up DKIM for your own domain in a tool, it often signs with its own domain, so you get dkim=pass with d= set to the provider. DMARC ignores that signature for alignment.
The fix is to set up custom DKIM in the tool for your sending domain: publish the key it gives you at the selector it names, then turn signing on. In Google Workspace that means generating the key and clicking Start authentication; see DKIM selector not found in Google Workspace.
Relaxed vs strict alignment
Your DMARC record controls how close the match must be with two optional tags: aspf for SPF and adkim for DKIM. Each can be r (relaxed) or s (strict). If you leave them out, both default to relaxed.
- Relaxed: the domains only need to share the same organizational domain. Mail from
you@yourdomain.comaligns with a Return-Path ofbounce.yourdomain.comor a DKIMd=mail.yourdomain.com. - Strict: the domains must match exactly.
bounce.yourdomain.comwould not align withyourdomain.com.
For cold email, relaxed is almost always what you want, because providers commonly use a subdomain for bounces or signing. If your record has aspf=s or adkim=s and you didn't set that on purpose, removing those tags is often the whole fix.
At Gmail, mail that fails alignment can be deferred with 421 4.7.32 or blocked with 5.7.32 ("the From: header ... isn't aligned"). See Gmail 4.7.32 / 5.7.32: From header not aligned.
How to find which one is failing
- Send a test from the exact mailbox and tool you use for outreach to a Gmail address you own. Open it, click the three dots, and choose Show original.
- Look at the Authentication-Results header. Note the domain after
smtp.mailfrom=(what SPF checked) and theheader.d=orheader.i=value (what DKIM checked). - Compare both with the domain in your From address. If neither shares your organizational domain, that's why DMARC fails. Or paste the headers into the free email header analyzer, which does this comparison for you in your browser.
- Run your domain through the free checker to confirm your SPF, DKIM and DMARC records are published and valid, and check whether your DMARC record sets strict alignment.
Fixes, in the order to try them
- Set up custom DKIM for your domain in every tool that sends as you. This is the most reliable fix, because DKIM survives forwarding and doesn't depend on the bounce domain.
- Set up a custom Return-Path or bounce domain on a subdomain of your sending domain, so SPF aligns too.
- Make sure that tool's sending servers are in your one SPF record, within the 10-lookup limit. See SPF record too many lookups.
- If your DMARC record uses
aspf=soradkim=s, switch to relaxed unless you have a reason not to. - Never send cold email with a From address on a domain you don't control, such as a free mailbox domain, through a third-party tool. Those domains publish strict DMARC policies and the mail will fail.
What happens if you leave it
With p=none, DMARC failures are only reported, but Gmail and Yahoo both require aligned DMARC for bulk senders, and unaligned mail is more likely to be filtered or rejected. With p=quarantine or p=reject, failing mail goes to spam or bounces outright, which can show up as a Gmail 550 5.7.26 or Yahoo 550 5.7.9 bounce.
Alignment also breaks quietly: a new tool gets connected without custom DKIM, or someone edits DNS and drops a record. OutboxWatch's paid plans re-check SPF, DKIM, DMARC, MX and blacklists every day and flag changes; the free checker is there any time you want a quick look. For choosing a policy, see DMARC policy for cold email.
Frequently asked questions
Do I need both SPF and DKIM aligned to pass DMARC?
No. DMARC passes if either SPF or DKIM passes and is aligned with the From domain. Aligning DKIM is the safer one to rely on, but setting up both gives you a backup.
Why does my header say spf=pass but DMARC fails?
SPF checked the Return-Path (bounce) domain, which is probably your sending tool's domain rather than yours. Set up a custom bounce domain, or make sure DKIM signs with your own domain.
What is the DKIM d= domain?
It's the domain that signed the message, shown in the DKIM-Signature header and in Authentication-Results as header.d. For DMARC it has to share your From address's organizational domain (or match it exactly with adkim=s).
Should I use strict alignment for cold email?
Usually not. Relaxed alignment is the default and lets subdomains such as a bounce or mail subdomain align with your main domain, which is how most sending tools are set up.
Will changing my DMARC policy fix an alignment failure?
No. The policy only decides what happens to failing mail. To pass, fix the alignment itself with custom DKIM or a custom Return-Path.
Related guides
- Gmail 4.7.32 / 5.7.32: the From header isn't aligned
- DMARC policy for cold email: what to publish and when
- DKIM selector not found in Google Workspace: how to fix it
- Gmail 550 5.7.26: why your email bounced as unauthenticated, and how to fix it
- SPF record: too many DNS lookups, and how to fix it
- All guides
- Monitoring plans