Skip to content
  • There are no suggestions because the search field is empty.

Identifier alignment for SPF and DKIM

DMARC only counts an SPF or DKIM pass if the domain that passed lines up with the domain in the visible From address. That match is called identifier alignment. A message passes DMARC when either SPF or DKIM passes for an aligned domain. One is enough. If SPF passes for your email vendor's domain and DKIM is signed with the vendor's domain, both checks pass, but neither is your domain, and DMARC fails for your mail.

What DMARC alignment compares

DMARC compares the Author Domain, the domain in the From header, with two possible authenticated identifiers:

Identifier Where it comes from Counts for DMARC when
Author Domain The From header (From: billing@example.com) It's the reference everything is compared with
SPF identifier The envelope sender: MAIL FROM, usually visible as Return-Path SPF passes for that domain
DKIM identifier The d= tag of a DKIM signature The signature verifies

A few things DMARC doesn't look at: the display name, Reply-To, Sender, and SPF's HELO check. A message from "Example Billing" <x@random.example> is judged on random.example, not on the name. Display-name abuse is out of scope.

The difference between the envelope sender and the From header is explained in Envelope From vs Header From.

The pass rule

Written out, DMARC passes if:

(SPF passes AND the SPF domain aligns) OR (DKIM passes AND the DKIM domain aligns)

If one or more authenticated identifiers align with the Author Domain, the result is pass; if none exist or none align, it's fail. In other words, messages must pass SPF authentication and SPF alignment, or DKIM authentication and DKIM alignment.

If a message has several DKIM signatures, any one valid, aligned signature is enough. A vendor's own signature next to yours doesn't hurt.

Why alignment exists

Without it, SPF and DKIM prove nothing about your From address. Any domain owner, even a bad actor, can publish an SPF record for its domain and get a pass, and a message can bear a valid signature from any domain, even one used by a bad actor. Alignment ties the pass to the domain recipients actually see.

Worked examples

Alignment compares domains, not mailboxes, and comparisons ignore case. By default DMARC uses relaxed alignment: the two domains just need to share the same organizational domain. Strict alignment needs an identical domain. You set the mode separately for SPF (aspf) and DKIM (adkim). The modes are covered in Relaxed vs strict alignment.

These examples follow the usual alignment rules:

From domain Authenticated domain Relaxed Strict
news.example.com news.example.com Aligned Aligned
news.example.com foo.example.com Aligned (same organizational domain) Not aligned
example.com bounces.example.com (MAIL FROM) Aligned Not aligned
news.example.com foo.example.net Not aligned Not aligned
example.com yourtenant.onmicrosoft.com Not aligned Not aligned

The last row catches people out. yourtenant.onmicrosoft.com looks related, but its organizational domain is onmicrosoft.com, not example.com.

Relaxed alignment works in either direction. The authenticated domain can be a subdomain of the From domain, the From domain can be a subdomain of it, or both can be siblings under the same parent. A phrasing you'll sometimes see, that the From domain has to "match or be a subdomain of" the envelope domain, reads as one direction only, so go by the same-organizational-domain rule.

Reading it in a header

A typical header can show SPF and DKIM both passing and DMARC still failing:

Authentication-Results: spf=pass (sender IP is 198.51.100.10)
 smtp.mailfrom=bounces.vendor.example; dkim=pass (signature was verified)
 header.d=vendor.example; dmarc=fail action=oreject
 header.from=example.com;compauth=fail reason=000

Compare three values:

  • smtp.mailfrom=bounces.vendor.example: SPF passed for vendor.example's organizational domain.
  • header.d=vendor.example: DKIM passed for vendor.example.
  • header.from=example.com: the domain recipients see.

Neither passing domain shares an organizational domain with example.com, so there's no aligned pass. That's a DMARC alignment failure, and it's the classic pattern when a service sends as your domain but bounces and signs with its own. Symptom-by-symptom troubleshooting is in Mail started failing after we published DMARC and Third-party mail fails alignment.

Gmail has its own message for the same condition. A 421 4.7.32 reply says the From header isn't aligned with either the authenticated SPF or DKIM organizational domain.

Your aggregate reports show the same thing across all your mail. For each source, the reports include the SPF and DKIM domains evaluated and whether each was aligned. Reading them is covered in A field-by-field walk-through of a DMARC aggregate report.

How to get a sender aligned

When a service fails alignment, you have three vendor-neutral options. Microsoft's documentation lists the same ones.

  1. Have the service sign DKIM with your domain. d=example.com, or a subdomain such as d=mail.example.com. Usually you publish a CNAME or TXT record the vendor gives you.
  2. Have it use a custom MAIL FROM (Return-Path) on your domain, such as bounces.example.com, so SPF passes for a domain that aligns.
  3. Give the service its own subdomain to send from, with its own SPF and DKIM.

If you can only do one, make it DKIM. SPF checks the connecting server's IP, so it usually breaks when mail is forwarded, while a DKIM signature survives as long as the message isn't changed (more in Forwarded mail fails DMARC and Email forwarding, SRS, and ARC).

Adding the vendor's include: to your SPF record doesn't fix alignment on its own. It makes SPF pass for the MAIL FROM domain, and if that domain is still the vendor's, it doesn't align (SPF include vs DKIM from the vendor). The full process for adding a sender is in How to add a third-party sender without breaking DMARC.

Mistakes worth avoiding

  • Leaving a vendor on its default settings. Many services start out signing with their own d= and bouncing to their own domain.
  • Setting strict SPF alignment (aspf=s) while bounces use a subdomain. bounces.example.com doesn't strictly align with example.com.
  • Counting on SPF alignment for forwarded mail. It usually doesn't survive forwarding.
  • Comparing the wrong fields. In Authentication-Results, compare smtp.mailfrom= and header.d= against header.from=, not against each other.
  • Thinking alignment means the same email address. It compares domains, and relaxed mode only needs the same organizational domain.

How DMARC uses this result is in What is DMARC and how it works.

Free DMARC account

Turn raw DMARC reports into a readable dashboard

Point your rua address to our platform and read the results by sender and source instead of opening XML files.

  • Results grouped by sending source
  • SPF, DKIM and alignment results per sender
  • The original XML reports are still there to download

Create a free DMARC accountTalk to an expert

FAQ

Do I need both SPF and DKIM aligned?

No. One aligned pass is enough. Aligned DKIM is the more durable choice, because it usually survives forwarding.

Does the Return-Path have to be exactly my From domain?

Not with relaxed alignment, the default. bounces.example.com aligns with example.com. With aspf=s it has to be identical.

Does DMARC look at Reply-To?

No. Only the From header domain, compared with the SPF and DKIM domains.

Does adding a vendor's SPF include make its mail align?

Only if the vendor also uses your domain, or a subdomain, as the MAIL FROM. Otherwise SPF passes for the vendor's domain, which doesn't align with yours.