Skip to main content

SPF, DKIM and DMARC

SPF, DKIM and DMARC Explained: How They Work Together

By Tom Sather•Published •8 min read

SPF checks the sending server, DKIM checks a signature, and DMARC checks that one of them passed for your From domain and says what to do if not.

On this page

SPF, DKIM and DMARC are three DNS-based checks that let a receiving mail server decide whether a message really comes from the domain it claims. SPF checks whether the sending server is allowed to send for the bounce address's domain, DKIM checks a cryptographic signature added by the sender, and DMARC checks that at least one of those passed for the domain in the visible From address, then tells the receiver what to do if not. You need all three, and they only protect you when they line up with the same domain.

If you just want to know whether yours are set up, run your domain through the SPF, DKIM and DMARC checker. The rest of this page explains what it's checking.

Why email needs authentication at all

SMTP, the protocol that moves email, was designed in the early 1980s for a small network of people who trusted each other. It lets the sender type anything into the From line. Nothing in the protocol stops a server in another country from sending mail "from" billing@example.com.

SPF, DKIM and DMARC were bolted on later, each fixing part of that problem. That history is why they overlap in confusing ways: none of them was designed alongside the others.

The two addresses on every message

To understand any of this, you have to know that every email has two sender addresses:

  • The envelope sender, also called the Return-Path or MAIL FROM. It's where bounces go. Recipients don't see it. When you send through an email service provider, it's usually the provider's domain, like bounce-123@mail.esp-example.net.
  • The header From, the address recipients actually see, like news@example.com.

SPF checks the first. DKIM checks whatever domain signed the message. Neither one, on its own, checks the second. That's the gap DMARC fills.

SPF: which servers can send for a domain

SPF (Sender Policy Framework, RFC 7208) is a TXT record listing the servers allowed to send mail using your domain in the envelope sender:

example.com.  TXT  "v=spf1 include:_spf.google.com include:mail.esp-example.net -all"

When a message arrives, the receiver takes the domain from the Return-Path, looks up its SPF record, and checks whether the connecting IP is on the list. The result is pass, fail, softfail, neutral, none, or one of two errors (temperror and permerror). The -all or ~all at the end says what to do with servers not on the list.

SPF's two big weaknesses:

  • It breaks on forwarding. When a message is forwarded, the forwarding server's IP isn't in your record, so SPF fails at the final destination.
  • It has a 10 DNS lookup limit. Every include costs at least one, nested ones count too, and going over makes SPF return permerror for all your mail. See the SPF 10 DNS lookup limit, or count yours with the SPF lookup counter.

For the full syntax, see What is an SPF record?, and for what each result means, SPF fail, softfail, permerror and temperror.

DKIM: a signature that travels with the message

DKIM (DomainKeys Identified Mail, RFC 6376) has the sending server sign each message with a private key. The signature goes into a DKIM-Signature header, and the matching public key is published in DNS at a name built from a selector and the signing domain:

DKIM-Signature: v=1; a=rsa-sha256; d=example.com; s=s1;
  h=from:to:subject:date; bh=...; b=...

The receiver reads d=example.com and s=s1, fetches the public key from s1._domainkey.example.com, and checks two things: that the body still matches the body hash (bh=), and that the signed headers still match the signature (b=). If both hold, DKIM passes for example.com.

DKIM's strength is that it survives forwarding, because the signature travels inside the message. Its weakness is that anything that changes the signed content in transit (a footer, a rewritten subject line) breaks it. DKIM fail: body hash did not verify and other causes covers how that happens.

Google requires DKIM keys of at least 1024 bits for mail to personal Gmail accounts and recommends 2048.

DMARC: tying it to the From address

DMARC (RFC 9989, which replaced RFC 7489 in May 2026) is a TXT record at _dmarc.example.com:

v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com

It adds the check that matters to recipients: did SPF or DKIM pass for a domain that matches the visible From domain? That match is called alignment. Under the default relaxed mode, the two domains just need the same organizational domain, so a DKIM signature from mail.example.com aligns with a From of example.com.

A message passes DMARC if either:

  1. SPF passes and the Return-Path domain aligns with the From domain, or
  2. DKIM passes and the signing domain (d=) aligns with the From domain.

One is enough. DMARC then does two more things SPF and DKIM can't: it publishes a policy for failing mail (p=none, quarantine or reject; see DMARC policy: none vs quarantine vs reject), and it asks receivers to send you reports on everyone using your domain (see how to read DMARC reports).

For the full explainer, see What is DMARC? and DMARC record syntax and tags.

How the three work together: one message, three checks

Say you send a newsletter through an email service provider, with From: news@example.com. Here are three ways it can come out.

SetupSPFDKIMDMARC
Provider uses its own Return-Path and its own DKIM domainpass (esp-example.net)pass (esp-example.net)fail: nothing aligned with example.com
You set up custom DKIM so the provider signs as example.compass (esp-example.net)pass (example.com)pass on aligned DKIM
Custom DKIM plus custom Return-Path at bounce.example.compass (bounce.example.com)pass (example.com)pass on both

The first row is the single most common authentication problem there is. Both checks "pass," the provider's dashboard shows green, and DMARC still fails because neither pass was for your domain. If you see it, DMARC fail: why it fails and how to fix it walks through the fix.

The third row is the goal. Aligned DKIM carries you through forwarding; aligned SPF is a backup if a signature breaks.

Where to see the results

Every receiver records its verdict in an Authentication-Results header on the delivered message:

Authentication-Results: mx.google.com;
       dkim=pass header.i=@example.com header.s=s1;
       spf=pass smtp.mailfrom=bounce.example.com;
       dmarc=pass (p=QUARANTINE) header.from=example.com

Send a test message to a mailbox you control, view the original, and find this header. Microsoft adds its own compauth result, which combines these checks with other signals. Paste the whole header block into the email header analyzer if you'd rather not read it by eye, or see how to read an email header.

What the big mailbox providers require

  • Google requires all senders to personal Gmail accounts to use SPF or DKIM, and bulk senders (more than 5,000 messages a day) to use SPF, DKIM and DMARC, with the From domain aligned with the SPF or DKIM domain. The DMARC policy can be none.
  • Yahoo has essentially the same rules: SPF or DKIM for everyone; SPF, DKIM and a passing DMARC policy of at least p=none for bulk senders.
  • Microsoft requires high-volume senders to Outlook.com, Hotmail and Live addresses to pass SPF, DKIM and DMARC, and rejects mail that doesn't with 550 5.7.515.

Missing authentication at Gmail shows up as 550 5.7.26. For the background, see the Gmail and Yahoo bulk sender updates.

What authentication doesn't do

Passing all three proves who sent the message. It doesn't prove the message is wanted. A fully authenticated sender with a dirty list and high complaint rates still lands in spam, and now the reputation damage is pinned firmly to their own domain. Authentication is the entry ticket. Reputation is what gets you to the inbox. If you're authenticated and still in spam, start with why emails go to spam.

A setup checklist

  1. List every service that sends mail as your domain: email provider, CRM, helpdesk, billing, HR, website forms.
  2. Publish one SPF record that covers the services using your domain in the envelope sender, under 10 lookups.
  3. Turn on custom DKIM in every one of those services so each signs with your domain.
  4. Publish DMARC at p=none with a rua address. The DMARC record generator will build it.
  5. Read the reports, fix what fails, then move toward p=reject.

When to get help

If you've worked through the checklist and something still fails, or your DMARC reports show sources nobody on your team recognizes, it's worth having someone who does this every day take a look.

FAQ

Do I need all three?

Yes, if you send any volume. Bulk senders to Gmail and Yahoo are required to have all three, and without DMARC nothing stops others from using your domain in the From line.

If I have DKIM, do I still need SPF?

Yes. DMARC only needs one aligned pass, but SPF is a required item for bulk senders at Gmail and Yahoo, and it gives you a backup when a DKIM signature breaks in transit.

Why does my email fail DMARC when SPF and DKIM pass?

Because they passed for a different domain, usually your email provider's. Set up custom DKIM so the provider signs with your domain.

Does passing SPF, DKIM and DMARC guarantee the inbox?

No. It proves the mail is really from you. Whether it reaches the inbox depends on your reputation: complaints, engagement, list quality and sending patterns.

Sources

In this section

Still stuck?

Some deliverability problems take an experienced eye to untangle. Tell me what you're seeing and I'll tell you what I'd check first. The first 30-minute call is free.