Guides · Email · Updated

SPF, DKIM and DMARC explained in plain words

SPF lists the servers allowed to send mail for your domain. DKIM signs each message so receivers can tell it was not altered. DMARC ties the two to the address people actually see in the From line, and tells receivers what to do when a message fails.

The problem they solve

Email was built without any check on who sends it. Anyone can put billing@yourcompany.com in the From line. Spammers and phishers do exactly that, and receiving mail servers have no way to tell real mail from forged mail unless the domain owner publishes some rules. These three DNS records are those rules.

SPF: which servers may send

SPF (Sender Policy Framework) is a TXT record listing the servers and services allowed to send mail for your domain:

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

The receiving server looks at the address the message actually came from and checks it against this list. SPF checks the envelope sender (the hidden return path), not the From address people see, which is one reason it isn't enough on its own. It also breaks when mail is forwarded, because the forwarding server isn't on your list.

The full syntax, the 10-lookup limit and common mistakes are in SPF record syntax.

DKIM: a signature on every message

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to each message's headers. Your mail service signs with a private key, and you publish the matching public key in DNS under a selector:

google._domainkey.example.com.  TXT  "v=DKIM1; k=rsa; p=MIIBIjANBgkqh..."

The receiver reads the selector and domain from the signature (s=google; d=example.com), fetches the key and verifies the message. A valid signature proves the message was sent by someone holding your key and was not changed on the way. DKIM survives forwarding, which SPF doesn't.

DMARC: tying it to the visible From address

Neither SPF nor DKIM looks at the From address a reader sees. DMARC (RFC 7489) closes that gap. A message passes DMARC when SPF or DKIM passes and the domain that passed matches the From domain (this is called alignment).

_dmarc.example.com.  TXT  "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"

The record also does two other things:

  • Policy (p=): tells receivers what to do with mail that fails: nothing (none), send it to spam (quarantine) or refuse it (reject).
  • Reporting (rua=): asks receivers to send you daily summaries of who sent mail as your domain and whether it passed. These reports show you every service you forgot about.

Tags, alignment modes and the path to enforcement are in what is DMARC.

How they work together

SPFDKIMDMARC
ChecksSending server's IPMessage signatureSPF or DKIM, aligned with From
DNS record atyourdomainselector._domainkey.yourdomain_dmarc.yourdomain
Survives forwardingNoUsuallyIf DKIM survives
Protects the visible FromNoNoYes

Check your domain's SPF record now:

Set them up in this order

  1. List every service that sends mail as your domain: your mailbox provider, newsletter tool, CRM, helpdesk, billing system, website contact form.
  2. Publish one SPF record that includes all of them. Check it with the SPF checker.
  3. Turn on DKIM in each service. Most give you a TXT or CNAME record to add. Confirm with the DKIM checker.
  4. Publish DMARC with p=none and a reporting address. Confirm with the DMARC checker.
  5. Read the reports for two to four weeks. Fix any legitimate source that fails.
  6. Move to p=quarantine, then p=reject.

Setup for your email provider

Exact records and where to find the account-specific values: Google Workspace, Microsoft 365, GoDaddy, Salesforce, Amazon SES, SendGrid, Mailgun, Mailchimp and Cloudflare Email Routing. If something fails, see why DKIM or DMARC fails, and to understand the DKIM part read what is a DKIM selector.

Why it matters now

Since February 2024, Gmail and Yahoo require every sender to have SPF or DKIM, and anyone sending more than 5,000 messages a day to their users to have SPF, DKIM and a DMARC record. Microsoft announced similar rules for Outlook.com in 2025. Mail that doesn't meet them is increasingly sent to spam or rejected.

If your mail already lands in spam, also check whether your sending server's address is on a blocklist with the IP blacklist checker.

Frequently asked questions

Do I need all three?

Yes, for reliable delivery. Gmail and Yahoo require SPF or DKIM for all senders, and SPF, DKIM and a DMARC record for anyone sending more than 5,000 messages a day to their users.

Which should I set up first?

SPF, then DKIM, then DMARC with p=none. Read the DMARC reports for a few weeks, fix any legitimate sender that fails, then move to quarantine and reject.

Does DMARC stop spam?

It stops other people from sending mail that claims to come from your domain. It does not filter spam you receive; your mail provider does that.