← Back to blog
A sealed white envelope with a glowing blue seal hovers before three translucent gateway frames as two blue beams meet on its seal, while unsealed envelopes drift away into the dark.
Security·November 16, 2026·12 min read

SPF, DKIM and DMARC Explained: Alignment, the 10-Lookup Limit, and What RFC 9989 Changed

Most DMARC failures happen when SPF and DKIM both pass for the wrong domain. Here is how alignment works, how the SPF 10-lookup limit breaks quietly, and what RFC 9989 changed about the record you publish.

Most DMARC failures are not SPF or DKIM failures. They are alignment failures: both checks pass, but for a domain that is not the one in the visible From address, so DMARC still says fail. And since May 2026, when RFC 9989 replaced the original DMARC document, the record you should publish has changed as well. pct is gone, a new t tag takes its place, and receivers find your organizational domain by walking the DNS tree instead of looking it up in the Public Suffix List.

This post goes through what each of the three protocols checks, why "SPF: pass" in a header can sit next to "DMARC: fail", how the 10-lookup limit silently breaks SPF, and what RFC 9989 means for the record in your DNS today.

What each protocol actually checks

The three are often listed together as if they were layers of the same thing. They check different identifiers, live in different places in DNS, and fail in different ways.

SPFDKIMDMARC
SpecRFC 7208RFC 6376RFC 9989 (obsoletes RFC 7489)
What it authenticatesThe connecting IP is allowed to send for the envelope sender domainThe message headers and body were signed by a domain's private keyThe visible From domain is backed by an aligned SPF or DKIM pass
Domain it checksMAIL FROM (the Return-Path / bounce address)The d= value in the DKIM-Signature headerThe RFC5322.From domain the reader sees
Where the record livesTXT at the domain itselfTXT at <selector>._domainkey.<domain>TXT at _dmarc.<domain>
Survives forwarding?Usually not: the forwarder's IP is not in your recordUsually, unless a mailing list modifies the body or subjectPasses if either aligned check survives

The key row is "domain it checks". SPF never looks at the From header. DKIM signs on behalf of whatever domain the signer puts in d=, which can be anything. Neither one, on its own, stops someone from sending mail that claims to be from your domain. That is the gap DMARC closes.

Why "SPF pass" does not mean DMARC pass

DMARC passes when at least one of SPF or DKIM passes for a domain that is aligned with the From domain. Here is a header set you will see constantly from marketing and billing platforms:

Return-Path: <bounce-8812@em.sendvendor.example>
DKIM-Signature: v=1; a=rsa-sha256; d=sendvendor.example; s=s1; ...
From: Billing <billing@example.com>
Authentication-Results: mx.receiver.example;
  spf=pass smtp.mailfrom=em.sendvendor.example;
  dkim=pass header.d=sendvendor.example;
  dmarc=fail header.from=example.com

Both underlying checks passed. SPF proved the vendor's IP may send for em.sendvendor.example, and DKIM proved the vendor signed the message. But neither authenticated example.com, so DMARC fails, and with p=reject this invoice never arrives.

How a receiver reaches a DMARC result Incoming message Return-Path domain em.sendvendor.example DKIM d= domain example.com From domain example.com SPF check IP allowed for Return-Path? DKIM check Signature valid for d=? Aligned with From domain? either one is enough pass, not aligned pass, aligned DMARC pass DMARC fail On fail, the receiver applies p= (or sp= / np=): none, quarantine or reject Here SPF passes for the vendor's bounce domain, but custom DKIM signs as example.com, so DMARC passes.

The diagram shows the fix in action. There are two ways to get alignment, and you want both where the vendor supports them:

Relaxed vs strict alignment

The adkim and aspf tags choose the mode, and both default to relaxed (r). Relaxed means the two domains share an organizational domain, so bounce.example.com aligns with example.com. Strict (s) means an exact match. RFC 9989 notes that nearly every domain owner finds relaxed enough. Strict is worth it mainly when different teams or tenants control different subdomains and you do not want one subdomain's mail to vouch for another.

The SPF 10-lookup limit, worked through

SPF has a limit that is easy to break without noticing. RFC 7208 caps an evaluation at 10 terms that need a DNS query: include, a, mx, ptr, exists and the redirect modifier, counted across every nested include. Past 10, the receiver returns permerror, which DMARC treats as an SPF failure for every message you send. The ip4, ip6 and all terms cost nothing.

Take this record from a company that has added vendors one at a time:

v=spf1 include:_spf.crm.example include:mail.helpdesk.example
       include:spf.esp.example mx a:relay.example.com -all

Each include pulls in the vendor's own record, which can contain more includes. With realistic (illustrative) nesting:

TermIts own lookupLookups nested insideRunning total
include:_spf.crm.example134
include:mail.helpdesk.example116
include:spf.esp.example129
mx1010
a:relay.example.com1011: permerror

Nothing in the record looks wrong, and it worked last month, before the ESP added one nested include to its own record. That last point is the real danger: your lookup count depends on DNS records you do not control. Two more limits apply. Each mx may resolve to at most 10 hosts, and RFC 7208 recommends that receivers fail after more than two "void lookups" (queries that return no records), which catches includes pointing at domains that have dropped their SPF record.

The usual fixes, roughly in order of preference:

  1. Remove vendors you no longer use. Stale includes are the most common cause.
  2. Replace mx and a with ip4:/ip6: ranges when your own servers rarely change.
  3. Move a vendor's mail onto a subdomain with its own SPF record. Marketing mail from news.example.com does not need to fit in the root record's budget.
  4. Flatten includes into IP ranges only with automation that re-resolves them on a schedule. A hand-flattened record goes stale the next time the vendor changes IPs, and then that vendor's mail fails SPF without any error to warn you.

~all or -all?

DMARC decides what happens to failing mail, so most domains end SPF with ~all (softfail) and let p= do the enforcing. RFC 9989 adds a practical warning about -all: some receivers check SPF early in the SMTP session, and a hard fail can get a message rejected before DMARC ever runs. That includes a message that would have passed DMARC through an aligned DKIM signature. Those rejections also never show up in your aggregate reports, because the receiver never got as far as reading the From header.

What RFC 9989 changed

The original DMARC spec, RFC 7489 (2015), was an Informational RFC published through the Independent Submissions stream. RFC 9989 is the IETF Standards Track version (the "DMARCbis" drafts), published in May 2026. Aggregate reporting moved to RFC 9990 and failure reporting to RFC 9991. The changes that affect the record you publish:

RFC 7489RFC 9989
pctApply the policy to 0 to 100 percent of failing mailRemoved. Unknown tags must be ignored, so updated receivers ignore it
tDid not existt=y asks receivers to apply one level below p (reject acts as quarantine, quarantine as none)
npOnly in experimental RFC 9091Standard: policy for non-existent subdomains
psdDid not existy, n or u: marks public suffix domains, or pins your organizational domain
rf, riFailure report format, report intervalRemoved
Organizational domainPublic Suffix List lookupDNS tree walk over _dmarc records
StatusInformationalStandards Track

The reason for dropping pct is in Appendix A.6 of the RFC. Operational experience showed receivers only applied it consistently at 0 and 100. Values in between were implemented inconsistently, while pct=0 had become a signal that mailing lists and intermediaries used to rewrite the From header. The t tag keeps exactly that useful behavior with two clear values.

The DNS tree walk

Under RFC 7489, a receiver found your organizational domain (the thing relaxed alignment compares) by matching the domain against a copy of the Public Suffix List. Different receivers used different copies, refreshed at different times. RFC 9989 replaces this with queries for _dmarc records up the tree, capped at eight queries so a long hostname cannot be used for a denial-of-service attack. Simplified:

// Simplified RFC 9989 section 4.10 org-domain discovery.
// lookupDmarc returns the single valid DMARC record at _dmarc.<name>, or null.
type Rec = { psd?: 'y' | 'n' | 'u' }
async function orgDomain(domain: string, lookupDmarc: (name: string) => Promise<Rec | null>) {
  const all = domain.toLowerCase().split('.')
  let labels = all
  let fewest: string | null = null
  let first = true
  while (labels.length > 0) {
    const name = labels.join('.')
    const rec = await lookupDmarc(name)
    if (rec?.psd === 'n') return name // explicitly an org domain
    if (rec?.psd === 'y' && !first) {
      return all.slice(-(labels.length + 1)).join('.') // one label below the PSD
    }
    if (rec) fewest = name // keep walking: the shortest name with a record wins
    // 8-query cap: a long name jumps straight to its last 7 labels.
    labels = first && labels.length >= 8 ? labels.slice(-7) : labels.slice(1)
    first = false
  }
  return fewest ?? domain
}

For almost every domain the answer is the same as before: example.com publishes _dmarc.example.com, and that is the organizational domain. The differences show up at the edges. A company running team.example.com as an independent unit can publish psd=n there to make it a separate organizational domain. A domain under a multi-label suffix that the PSL lists but that publishes no DMARC record can resolve differently. The RFC's own advice for avoiding any disagreement between old and new receivers is to publish an explicit DMARC record for every domain you send From, and to use strict alignment if the difference matters to you.

A rollout path that works under both specs

Receivers will not all update at once. An RFC 7489 receiver ignores t as an unknown tag and an RFC 9989 receiver ignores pct, so plan around both:

  1. v=DMARC1; p=none; rua=mailto:dmarc@example.com. Monitoring mode. Read the aggregate reports for a few weeks and find every source sending as your domain.
  2. Fix alignment for each legitimate source with custom DKIM and a custom Return-Path, and remove SPF includes for vendors you no longer use.
  3. p=quarantine; t=y. Updated receivers treat failures as none while you watch. An old receiver ignores t and quarantines for real, so only take this step once the reports look clean. If you want testing behavior from old receivers too, adding pct=0 covers them, at the cost of a tag that checkers following RFC 9989 will flag as obsolete.
  4. p=quarantine, then p=reject; t=y, then p=reject.

Add np=reject early in this process. Subdomains that do not exist never send legitimate mail, and spoofing them (secure-login.example.com) is a cheap phishing trick. Without np, they inherit sp if you set one, which is often looser than p.

This is no longer optional for bulk senders. Since February 2024, Gmail and Yahoo's sender requirements require anyone sending large volumes to their users to publish DMARC (p=none is the minimum) and to have From domains that align with SPF or DKIM.

DKIM: the part a DNS check cannot see

You can check SPF and DMARC from a domain name alone. You cannot do that for DKIM, because the key lives at <selector>._domainkey.<domain> and each sending service chooses its own selector name. Nothing in DNS lists them. To check DKIM you need a real message: its DKIM-Signature header names the selector and domain, and the receiver's Authentication-Results header tells you whether it verified and for which d=. Pasting the headers of a message you received into an email header analyzer is the quickest way to see whether header.d actually matches your From domain.

The selector design is also what makes key rotation painless, for the same reason kid values make JWKS key rotation safe. Publish the new key under a new selector, switch the signer over, and leave the old selector in DNS until messages signed with it are no longer in transit or being verified. Use 2048-bit RSA keys. 1024-bit keys still verify at most receivers, but they are well past their safe lifetime. If you have built webhook signature verification, DKIM will look familiar: canonicalize the signed headers and body, hash them, verify the signature against a published key. The difference is that the key is asymmetric and found through DNS rather than shared in advance.

The takeaway

When DMARC fails, check alignment first. Find the smtp.mailfrom and header.d values in Authentication-Results and compare them with the From domain. Then count your SPF lookups including nested includes, because a vendor can push you past 10 without you changing anything. Finally, update the record itself for RFC 9989: drop pct in favor of t=y for staged rollouts, add np=reject, and publish explicit _dmarc records for every domain you send From, so the move from the Public Suffix List to the tree walk changes nothing for you. An SPF and DMARC checker will list every include with its lookup count and flag the obsolete tags before a receiver rejects your mail.

#spf#dkim#dmarc#email-authentication#rfc-9989#dns
ShareXLinkedInHacker News

Try it

Free, in your browser, no sign-up.

New posts by email

One email when a new post goes up. No other mail; unsubscribe in one click.

We store your email only to send new posts. See the privacy policy.

Related reading

Security
How TOTP Codes Actually Work: The HMAC Math Behind Your Authenticator App
Security
How AI Coding Agents Actually Sandbox Code Execution: gVisor, Firecracker, and What Docker Alone Doesn't Stop
Security
JWK Rotation in Production: What Actually Breaks When You Rotate a Signing Key