DMARC fail: SPF and DKIM not aligned (how to fix it)
Your email can pass SPF and DKIM and still fail DMARC if the domains those checks verified do not match your visible From address. The fix is to make at least one of them use your own domain, usually by setting up domain authentication (DKIM) in each service that sends email for you.
DMARC alignment failure means your email passes SPF or DKIM, but the domain those checks verified is not the same as the domain in the visible From address. DMARC needs at least one of them to pass and match, so a message can fail DMARC even when the other checks show green. It is common, it is fixable, and you do not need to be a developer to understand it.
What the problem is and what you see
Every email carries more than one sender identity. People see the From address, for example hello@yourshop.com. Behind the scenes there are two more:
- SPF checks the Return-Path domain (also called the envelope sender or MAIL FROM).
- DKIM checks the
d=domain inside the signature.
DMARC adds one rule: at least one of those must pass and also match the From domain. That match is called alignment.
A typical case: you send a newsletter through an email service. SPF passes, but for the service's bounce domain. DKIM passes, but it is signed with the service's domain. Both pass, neither matches your From domain, so DMARC fails.
What people usually notice:
- A header check or DMARC report shows
dmarc=failnext tospf=passanddkim=pass. - Invoices, form notifications or newsletters land in spam or bounce, while mail from your normal mailbox is fine.
- Bounce messages mention a DMARC policy.
Why it matters
If your policy is p=none, failing mail is still delivered, but it is more likely to be treated as suspicious and you get no protection against forgery. If your policy is p=quarantine or p=reject, receivers send failing mail to spam or refuse it. That can quietly swallow order confirmations, password resets, quotes and invoices, which costs sales and trust.
Gmail and Yahoo also expect bulk senders (roughly 5,000 or more messages a day) to have DMARC with aligned SPF or DKIM. Even small senders benefit, because alignment is what lets receivers tell your real mail from someone pretending to be you.
How to check (free)
- Send a test email from the affected system (your newsletter tool, shop, form or mailbox) to a Gmail address you control.
- Open it, click the three dots, choose Show original. At the top you see SPF, DKIM and DMARC results.
- Open the full headers and find the
Authentication-Resultsline. Compare three domains:header.from,smtp.mailfrom(SPF) andheader.d(DKIM). - Look up your DMARC record with a free tool such as MXToolbox, or run
dig TXT _dmarc.yourdomain.com. Note whether it containsadkim=soraspf=s(strict mode).
| Check | Domain compared with From | Aligned when |
|---|---|---|
| SPF | smtp.mailfrom (Return-Path) | Passes and matches the From domain |
| DKIM | header.d (signature) | Passes and matches the From domain |
| DMARC | Either of the above | At least one is aligned |
In relaxed mode (the default) a subdomain such as mail.yourdomain.com matches yourdomain.com. In strict mode it must match exactly.
To see all your senders at once, add a rua=mailto: address to your DMARC record and read the aggregate reports with a free report reader such as Postmark's DMARC digests or dmarcian's free tier. They list every source and whether it aligned.
How to fix it
The most reliable route is DKIM alignment, because a DKIM signature survives forwarding while SPF often does not.
- List everything that sends email as your domain: your mailbox provider, website host, newsletter tool, CRM, online shop, invoicing, helpdesk and contact form plugins.
- In each service, find the domain authentication setting. It is often called Authenticate your domain, Sender authentication or Verify domain. It gives you CNAME or TXT records.
- Publish those records at your DNS host (where your nameservers point), then click the verify button in the service.
- If the service offers a custom return-path or bounce domain, set that up too. It makes SPF align as well.
- Do not just add the service to your SPF record and stop. That makes SPF pass, but the Return-Path is still the vendor's domain, so it still does not align.
- If you use strict mode (
adkim=soraspf=s) and a service signs with a subdomain, either change it to relaxed (r) or remove the tag. - If a tool cannot sign with your domain at all, send through your main mail provider instead, or change the tool.
If there is no DKIM at all yet, start with DKIM not set up.
Common platforms
Menu names change between versions, so treat these as a guide to where to look.
- Google Workspace: Admin console, Apps, Google Workspace, Gmail, Authenticate email. Generate a key, publish the TXT record, then start authentication. See the Google Workspace guide.
- Microsoft 365: Microsoft Defender portal, Email and collaboration, Policies and rules, Threat policies, Email authentication settings, DKIM tab. You publish two CNAME records, then enable signing. See the Microsoft 365 guide.
- Shopify: usually under Settings, Notifications, Sender email, where you can authenticate your domain.
- HubSpot: usually under Settings, Domains and URLs, where you connect an email sending domain.
- WordPress: the site often sends mail through the host's default mail function, which is usually not signed with your domain. Send through your mail provider's SMTP or a transactional email service that signs with your domain.
- Cloudflare: if your DNS is there, add the DKIM CNAME records as DNS only (grey cloud), not proxied.
- cPanel: the Email Deliverability tool shows whether DKIM and SPF are valid for the domain and can repair them.
How to confirm the fix worked
- Wait a few hours after changing DNS, then click verify in the sending service.
- Send a new test from each system (not just one) to Gmail and use Show original.
- Look for
dmarc=pass, and check thatheader.dorsmtp.mailfrommatches your From domain. A DMARC pass with an unrelated domain would be unusual, so if you see one, recheck your record. - After a day or two, check your aggregate reports. Every legitimate source should show as aligned.
How to stop it coming back
- Move your policy up in steps:
p=none, thenp=quarantine, thenp=reject, and only when reports show all real senders passing. - Re-test whenever you add or change a tool that sends email, such as a new newsletter service, shop theme or CRM.
- Keep the
ruareports switched on so a broken sender shows up quickly. - Keep a short list of who sends as your domain and where its DNS records live, so nobody deletes them during a DNS clean-up or host move.
- Week 10 of SiteMonday covers domain, SSL and email deliverability, and its report ranks what to fix. See week 10. Making the changes is up to you or your developer.
When it still fails
Forwarding and mailing lists can break SPF and sometimes DKIM, since they change the sending server or the message body. That is why DKIM alignment with your own domain is the safer target. If one system keeps failing after you set up its domain authentication, check that you copied the record names and values exactly and that your DNS host did not append your domain a second time.
Step by step for your platform
- DMARC alignment failure on Google Workspace
- DMARC alignment failure on Microsoft 365
- DMARC alignment failure on HubSpot CMS
- DMARC alignment failure on Shopify
- DMARC alignment failure on WordPress
- DMARC alignment failure on Cloudflare
- DMARC alignment failure on cPanel
Questions
Can DMARC fail when SPF and DKIM both pass?
Yes. Both can pass for the sending service's own domain, but DMARC also requires at least one of them to match your From domain. If neither matches, DMARC fails.
Do I need both SPF and DKIM aligned?
No, one aligned and passing result is enough for DMARC to pass. DKIM is the more reliable one to aim for because it survives email forwarding.
What is the difference between relaxed and strict alignment?
Relaxed (the default) lets a subdomain match its parent domain, so `mail.example.com` aligns with `example.com`. Strict requires an exact match and is set with `aspf=s` or `adkim=s`.
Will adding a service to my SPF record fix alignment?
Usually not. It can make SPF pass, but alignment depends on the Return-Path domain, which stays the vendor's unless you set up a custom return-path. Setting up DKIM for your domain is the usual fix.
Is it safe to set my DMARC policy to reject right away?
No. Start with `p=none`, read the reports, fix every legitimate sender, then move to quarantine and finally reject. Jumping straight to reject can block your own invoices and notifications.
How long until the fix shows up?
DNS changes often work within a few hours but can take longer depending on your DNS host. Send a fresh test after verifying in the sending service, since old messages keep their old results.