DMARC Monitor

DMARC fail when SPF or DKIM passes: alignment and the fix

By Matt Pritchett · · 6 min read

A DMARC fail means neither SPF nor DKIM passed for the domain in your From address. That is why a header can show spf=pass and dkim=pass and still say dmarc=fail: both checks passed, but for someone else's domain, usually the service that sent the message for you. The DMARC standard calls the missing piece alignment. The fix is almost never another DNS record on your side. It is setting up the sender that failed so it sends and signs as your domain.

What DMARC actually checks

DMARC does not run its own test. It takes the SPF and DKIM results the receiving server already has and asks one more question: did either of them pass for your domain? The standard, RFC 7489, puts it like this: a message satisfies the DMARC checks if at least one of the supported authentication mechanisms produces a "pass" result, and produces that result based on an identifier that is in alignment.

There are two identifiers to line up with your From address:

  • SPF checks the bounce address, the Return-Path. Many sending services use their own domain there, like sendgrid.net, so SPF passes for them, not for you.
  • DKIM checks the domain in the signature's d= tag. A service that signs with its own key passes DKIM for its domain, not yours.

The standard explains why it is strict about this: a message can bear a valid signature from any domain, including domains used by a mailing list or even a bad actor. A pass for some domain proves nothing about whether your domain sent it.

One aligned pass is enough. If DKIM passes for your domain, DMARC passes even when SPF fails, and the other way round.

Read the three results in the header

Open the message in the mailbox that received it, not your sent folder, because the receiving server is the one that writes the results. In Gmail, open the message, use the three-dot menu and choose Show original. Find the Authentication-Results line. A message that fails DMARC this way often looks something like this:

Authentication-Results: mx.google.com; spf=pass smtp.mailfrom=bounces.mailservice.net; dkim=pass header.d=mailservice.net; dmarc=fail header.from=yourshop.com

Read it left to right:

  • spf=pass smtp.mailfrom=bounces.mailservice.net: SPF passed, for the sender's bounce domain.
  • dkim=pass header.d=mailservice.net: DKIM passed, for the sender's signing domain.
  • dmarc=fail header.from=yourshop.com: your From domain matched neither.

Compare the domain after smtp.mailfrom= and after header.d= with the one after header.from=. If neither matches, that is your answer. If you don't want to do it by eye, paste the whole header into the email header analyzer. It shows whether SPF, DKIM and DMARC passed for the From address and marks a check that passed for another domain as not aligned.

What counts as a match

DMARC has two alignment modes, set by the adkim= and aspf= tags in your DMARC record. Relaxed is the default and lets a subdomain match: in RFC 7489's own example, a signature with d=example.com is in alignment with a From address of alerts@news.example.com. Strict wants an exact match, so that same message would fail.

If you send from a subdomain and your record has adkim=s or aspf=s, that alone can turn a pass into a DMARC fail. Most small businesses should leave both on relaxed, which is what you get when the tags are left out.

The usual causes, and the fix for each

A sending service using its own domain

This is the most common one. A newsletter tool, help desk, CRM or transactional service sends as you@yourshop.com, but signs with its own DKIM key and uses its own bounce domain. Both checks pass for the service. DMARC fails for you.

The fix is in the service, not in your DMARC record. Look for a setting called domain authentication, custom domain, sender authentication or custom DKIM. It gives you one or more records to publish (often CNAMEs under its own selector), and after that it signs as your domain. Then check the key is live with the DKIM checker. If the service also offers a custom bounce domain, set that up too, so SPF lines up as well. When you add its SPF include, keep everything in one SPF record: the SPF record generator builds that one record and counts its lookups against the limit of 10.

WordPress mail sent by the web host

WordPress sends every email through wp_mail(), and by default it leaves from the server your site is hosted on. That server may pass SPF for the host's own domain and sign with nothing, or with the host's key. Your password resets, contact form alerts and WooCommerce receipts then fail DMARC for your domain.

Our post on WordPress emails going to spam walks through this case. The lasting fix is to send WordPress mail through a service that authenticates your domain, rather than trying to make a shared host sign for you.

Forwarding and mailing lists

When someone forwards your message, or a mailing list resends it, the message leaves from a server that is not in your SPF record, so SPF fails. Lists also tend to change the message: RFC 7960, which covers these problems, lists adding a footer to the email body and prepending a tag to the subject among the changes, and says any such modifications would invalidate a DKIM signature.

You can't fix someone else's forwarder. What you can do is make sure your own mail carries an aligned DKIM signature, because a forward that leaves the message untouched keeps it valid, and DMARC only needs that one aligned pass. Expect a small number of forwarding failures in your reports and don't chase each one.

Strict alignment on a subdomain

Covered above: adkim=s or aspf=s with mail from a subdomain. Switch to relaxed unless you have a reason not to.

Someone else sending as your domain

Sometimes the sender that fails DMARC isn't yours at all. If you don't recognise the server or the service, treat the mail as suspect. This is the mail DMARC is there to stop, and it is why you eventually move from p=none to enforcement.

Find every sender that fails, not only this one

One header shows you one message. Your domain probably has several services sending as it, and any of them can be the one that fails. The DMARC report analyzer reads the zipped XML reports from Google, Yahoo or Microsoft and shows who sends as your domain, what fails and the fix. If your record has no rua= address yet, you aren't getting those reports.

Don't move your policy to quarantine or reject until every real sender passes. Once they do, follow our steps from p=none to reject.

Check your domain

Run the free DMARC checker on your domain. It reads your DMARC record and the SPF and DKIM behind it, grades them A to F, and gives you the exact record to paste. It only reads public DNS records and never changes your DNS. If a new email tool could break things again next month, monitor your domain free: monitoring reads your DMARC reports, rechecks daily and emails you when something newly breaks.

Written by The DMARC Monitor Team, assisted by Friday.