Skip to main content
Security
Published 3 min read

SPF vs DKIM vs DMARC Explained

Three standards, three different identities. Here is what each one checks and how DMARC combines them.

SPF, DKIM and DMARC are three DNS-based standards that help receivers decide whether a message really came from the domain it claims. They are often mentioned together, but each one checks something different, and the differences explain most of the confusing results you see in email headers.

The short version

StandardChecksIdentityHow it works
SPFIs this server allowed to send for the domain?Envelope sender (Return-Path) or HELOThe domain publishes allowed IPs in DNS
DKIMWas the message signed by the domain and left unchanged?The d= domain in the signatureA private key signs; a public key in DNS verifies
DMARCDoes SPF or DKIM pass for the visible From domain?The From domainPolicy in DNS plus an alignment check

SPF

Sender Policy Framework lets a domain publish, in a DNS TXT record, which servers may send mail using that domain in the SMTP envelope. The receiver compares the connecting IP address with that list. Because it looks at the envelope rather than the visible From, SPF alone does nothing to stop someone from forging the From address that people see. Forwarding often breaks SPF, since the forwarder's IP is not on the original domain's list.

DKIM

DomainKeys Identified Mail adds a cryptographic signature to the message. The signing domain publishes a public key in DNS under a selector, and a receiver uses it to check that the signed headers and body were not modified. DKIM survives forwarding if the message is unchanged, but mailing lists that edit the subject or footer can break it. The signing domain (d=) does not have to match the From domain, so a valid signature does not by itself tie the message to the address the reader sees.

DMARC

Domain-based Message Authentication, Reporting and Conformance joins the two. A message passes DMARC if SPF or DKIM passes and the passing domain aligns with the From domain. The domain owner publishes a policy of none, quarantine or reject, which tells receivers what to do with failures, and can request reports.

Alignment in one example

From:         [email protected]
Return-Path:  [email protected]   (SPF passes for example.net)
DKIM d=       example.com                  (DKIM passes for example.com)

SPF aligned?  No  (example.net is not example.com)
DKIM aligned? Yes (example.com matches the From domain)
DMARC:        PASS (one aligned pass is enough)

Alignment can be strict (exact match) or relaxed (same organizational domain, so mail.example.com aligns with example.com). Relaxed is the default.

Reading the results in headers

The receiving server normally records its verdicts in an Authentication-Results header, for example spf=pass, dkim=pass and dmarc=pass. Those are the receiver's reported results, so a viewer should read them as that server's statement. The Email Header Analyzer lays out each result with the domains involved and shows how the From, DKIM and SPF domains line up. Web teams will recognize the pattern from the HTTP Security Headers Analyzer and the CSP Analyzer: each reads a set of signals and reports what is present, not whether the whole system is safe.

Passing is not the same as trustworthy

All three standards prove that a domain authorized the message. A criminal who owns a look-alike domain can pass all three for that domain. Authentication narrows the question of who sent it; it does not answer whether to trust it.

Frequently asked questions

Do I need all three of SPF, DKIM and DMARC?
For a domain that sends email, publishing all three is the recommended baseline. DMARC depends on SPF or DKIM passing and aligning, and many large receivers now expect all three from bulk senders.
Which identity does SPF check?
The envelope sender domain (the MAIL FROM, shown as Return-Path) or the HELO name. It does not check the visible From address.
Can a message pass SPF and still fail DMARC?
Yes. If SPF passes for a different domain than the From domain, it passes but does not align, so DMARC can still fail.

The tool that pairs with this guide.

Did this help you tighten your security headers?

If these free developer tools save you time, consider buying me a byte. Your support helps keep DevCraftKit free and growing.

Buy me a byte 馃捑