SPF, DKIM, and DMARC, Explained Simply

SPF and DKIM authenticate the domain behind a message. DMARC ties that proof to the From: line and tells receivers what to do when it fails.

SPF, DKIM, and DMARC are three protocols with one job: making it hard for anyone to send mail that pretends to come from your domain. SPF and DKIM each authenticate a message in their own way. DMARC sits on top of them. It ties the result to the domain the reader sees, and tells receivers what to do when the check fails. Bulk senders to Gmail need all three, and the order you set them up in matters.

What SPF does, and what it can't do

An SPF record is a TXT entry in your DNS that names every server permitted to send mail as your domain. Gmail's guidelines say SPF prevents spammers from sending unauthorized messages that appear to be from your domain. The server on the receiving end compares that list with the machine the message really came from.

Gmail's guidelines say the SPF record for your domain should include all email senders for your domain. That includes any tool that sends on your behalf, like a billing platform or a CRM. Gmail's guidelines say if third-party senders are not in your SPF record, their messages are more likely to be marked as spam.

SPF has a hard limit. It checks the envelope sender, the hidden bounce address, not the From: line the reader sees. A message can pass SPF and still look like it came from someone else. SPF also breaks when mail is forwarded, because the forwarder's server is not in your record.

What DKIM does

DKIM works differently. Your server adds a cryptographic signature to the message, and you publish the public key in DNS. Gmail's guidelines say receiving servers use DKIM to verify that the domain owner actually sent the message. The signature covers the message body and selected headers, so tampering breaks it.

The key is published under a name you choose, called a selector. That lets you run several keys at once and rotate them without breaking old mail. Gmail's guidelines say sending to personal Gmail accounts requires a DKIM key of 1024 bits or longer, so do not publish anything shorter.

Because the signature travels inside the message, a relay that does not change the message passes it along intact.

Where SPF and DKIM fall short: the alignment problem

DMARC's standard says SPF and DKIM provide domain-level authentication but are not directly associated with the Author Domain. The Author Domain is the domain name of the apparent author as extracted from the RFC5322.From header field. In plain terms, it is the domain in the From: line.

A spammer can send a message that passes SPF or DKIM for their own domain while putting your domain in the From: line. Neither protocol compares the two. That is the gap DMARC fills.

What DMARC adds: policy, alignment, and reporting

DMARC's standard says it is designed to prevent unauthorized use of the Author Domain of an email message, a technique known as spoofing. Spoofed messages meant to entice a recipient to give sensitive information are commonly called phishing.

DMARC's standard says a message needs alignment between the Author Domain and an Authenticated Identifier to achieve a DMARC pass. Alignment comes in two flavors. Relaxed alignment means the Author Domain and the Authenticated Identifier share the same Organizational Domain, so mail from billing.example.com aligns with example.com. Strict alignment means the Author Domain is identical to the Authenticated Identifier.

A message passes the DMARC check if one or more Authenticated Identifiers align with the Author Domain. It fails if no Authenticated Identifiers exist or none align. This is why a message that passes SPF can still fail DMARC: the domain that passed SPF was not the domain in the From: line.

On top of the verdict, DMARC adds two things SPF and DKIM never had. A policy, which tells receivers what to do with failing mail, and reporting, which tells you what receivers saw.

Anatomy of a DMARC record: the tags that matter

DMARC Policy Records are stored as DNS TXT records with names starting with the label _dmarc. Google Workspace Help says the host value should be _dmarc followed by your domain name. A domain owner can choose not to take part in DMARC by simply not publishing a record.

The tags that matter most:

  • v: required, and DMARC1 is the only value it accepts. If the v tag is missing, comes after another tag, or holds anything else, receivers throw out the entire record.
  • p: the policy. Google Workspace Help says the options are reject, quarantine, or deliver the message.
  • rua: where aggregate reports go. Google Workspace Help says the email address must include mailto. Mail receivers must not make aggregate reports if the rua tag is missing.
  • sp: sets the policy for subdomains of the organizational domain.
  • adkim and aspf: alignment mode for DKIM and SPF. Relaxed is the default for both. Google Workspace Help says relaxed DKIM alignment accepts any valid subdomain of the d= domain in the DKIM mail headers.

Setup order: SPF and DKIM first, then DMARC in monitoring mode

Google Workspace Help says you must turn on SPF or DKIM before you can use DMARC. Set up DKIM and SPF first, then DMARC. DMARC's standard agrees: a Mail Receiver that wants to take part should already be checking SPF and DKIM.

So the order is SPF and DKIM, then DMARC. For SPF, list every sender in the DNS TXT record at the root of your domain. For DKIM, turn on signing in your mail platform and publish the key under your selector.

Then publish DMARC with p=none. DMARC's standard says Domain Owners usually start with a policy of p=none and a rua tag pointing to the mailbox that receives aggregate reports. The standard gives this state a name: Monitoring Mode. A p=none start confirms the SPF and DKIM work you did first has no gaps. It also lets you audit your mail streams before you enforce anything.

Reading aggregate reports and moving toward enforcement

Aggregate reports show the sources of mail using your domain, with their SPF and DKIM results. DMARC's standard says they can reveal mail streams using the Author Domain that do not pass DMARC validation checks. Those failing streams may be illegitimate uses like spoofing, or legitimate uses that lack aligned Authenticated Identifiers.

Sort the failures into those two piles. For legitimate mail, fix the sending setup until it passes. DMARC's standard says shortcomings in legitimate mail streams must be fixed before the Domain Owner publishes an Enforcement policy for the Author Domain. Only then move p to quarantine, then reject. A Domain Owner can also use the sp tag to quarantine mail from a failing subdomain, while leaving the main domain alone.

What authentication does and doesn't do for deliverability

DMARC's standard says a DMARC pass does not by itself guarantee that delivery to the recipient's inbox would be safe or desirable. DMARC is commonly used as one input to more complex filtering decisions. Authentication shows which domain stands behind a message, not that the message is wanted.

It also has edges. DMARC's standard says it does not address the use of visually similar domain names or abuse of the human-readable display name. It can only be used to combat specific forms of exact-domain spoofing directly. A phisher who registers exanple.com instead of spoofing example.com is outside its reach.

Gmail's guidelines say authenticated messages are less likely to be rejected or marked as spam by Gmail. That is the honest version: authentication removes a reason to block you. It does not buy you the inbox by itself, the way a dead SORBS result proves nothing either way.

What Gmail and Yahoo expect from senders

Gmail's guidelines say bulk senders must set up SPF, DKIM, and DMARC for their domain. To pass DMARC, messages must be authenticated by SPF or DKIM, or both. The authenticating domain must match the domain in the From: header. Gmail's guidelines say messages that are not authenticated might be marked as spam or rejected with a 5.7.26 error.

Yahoo's guide strongly urges all senders to publish a DMARC policy for each sending domain. It also strongly recommends a rua tag, set up to receive reports, for monitoring during initial setup.

Authentication is one requirement among several. Gmail also asks for one-click unsubscribe headers on marketing mail. Set up SPF, DKIM, and DMARC in that order, start DMARC at p=none, read the reports, and only then enforce.

Sources

Filed

More filed under DMARC and BIMI

  • DMARC policy options: none, quarantine, and reject
  • How to Set Up DMARC for Google Workspace
  • How to set up a DMARC record for your domain
  • How a BIMI Logo Gets Next to Your Email
  • What BIMI Is and How It Works
  • Every DMARC Tag, What It Does, and Which You Need
  • How DMARC Handles Subdomains and the sp Tag
  • DMARC configuration, one tag at a time
  • Why a DMARC lookup Says Record Not Found
  • The DMARC TXT Record, Tag by Tag
  • What DMARC Is and How It Works
  • What a DMARC report service does for you