Blog

SPF, DKIM and DMARC in plain English

What SPF, DKIM and DMARC actually do, what the DNS records look like, and how to get your domain to p=reject without blocking your own email.

Draft, not published By The Domain Help Desk, , 7 min read

An envelope with an orange wax seal next to a small shield

If your invoices land in spam, or a customer once got a fake email that looked like it came from you, these three records are usually the reason. They’re short lines of text in your domain’s DNS. Together they tell the rest of the internet which servers are allowed to send email as your domain, and what to do with mail that fails the test.

Since February 2024, Gmail and Yahoo require bulk senders to have all three, and every sender to have at least SPF or DKIM. Microsoft followed with similar rules for Outlook.com. A small business that sends a few hundred emails a day isn’t a bulk sender, but missing records still cost you inbox placement. They’re worth getting right.

We’ll use example.com throughout. Swap in your own domain.

SPF: the guest list

SPF (Sender Policy Framework) is a single TXT record at the root of your domain that lists the servers allowed to send mail for it. For a business on Microsoft 365 it often looks like this:

example.com.  TXT  "v=spf1 include:spf.protection.outlook.com -all"

On Google Workspace:

example.com.  TXT  "v=spf1 include:_spf.google.com ~all"

Each include: pulls in another company’s list of servers. If you also send through a newsletter tool or an invoicing app, it gets an include: too.

Four things trip people up:

  1. One record only. A domain can have exactly one SPF record. Two records starting with v=spf1 is a permanent error, and many receivers treat that as a fail. Merge them into one.
  2. The 10-lookup limit. SPF allows at most 10 DNS lookups while checking a message. Every include:, a, mx, exists and redirect counts, and so do the includes nested inside them. Go over 10 and SPF returns a permanent error. Each provider’s include costs at least one lookup, and some contain nested includes of their own. Add a CRM, a helpdesk and two marketing tools and you can hit the limit without noticing. ip4: and ip6: entries don’t count.
  3. -all vs ~all. The ending says what to do with mail from servers not on the list. -all is a hard fail: “reject it.” ~all is a soft fail: “accept it but treat it as suspicious.” Once DMARC is enforcing (below), either works, because DMARC makes the final decision. -all is stricter, ~all is a little kinder to forwarded mail. Never use +all, which lets anyone send as you.
  4. SPF checks the wrong address, as far as people are concerned. It checks the hidden “envelope” sender (the Return-Path), not the From address your customer sees. A spammer can pass SPF for their own domain while putting your name in the From line. That gap is why DMARC exists.

DKIM: the wax seal

DKIM (DomainKeys Identified Mail) adds a digital signature to every message your mail service sends. The receiving server looks up a public key in your DNS and checks the signature. If the message was altered in transit, or wasn’t signed by your service at all, the check fails.

The signature carries two values that matter: d=, the domain that signed it, and s=, the selector, which says which key to look up. The key lives at selector._domainkey.yourdomain. A message signed with d=example.com; s=selector1 is checked against:

selector1._domainkey.example.com

Microsoft 365 uses two CNAME records, selector1._domainkey and selector2._domainkey, that point to keys Microsoft hosts and rotates for you. Google Workspace has you generate a key in the admin console and publish it as a TXT record, by default at google._domainkey. Use a 2048-bit key if you’re given the choice.

Each service that sends as your domain needs its own DKIM setup, with its own selector. That’s the point of selectors: your email provider, your newsletter tool and your invoicing app can each sign with their own key without stepping on each other.

The catch: many services sign with their domain unless you set up DKIM for yours. The mail is signed, but not by you, and that matters for the next part.

DMARC: the rule that ties them together

DMARC (Domain-based Message Authentication, Reporting and Conformance) is a TXT record at _dmarc.example.com. It does three things.

It checks alignment. A message passes DMARC if SPF or DKIM passes and the domain that passed matches the domain in the visible From address. For SPF, that’s the Return-Path domain. For DKIM, that’s the d= domain in the signature. By default the match is “relaxed,” so mail.example.com aligns with example.com. This is what closes the gap SPF leaves open: a spammer can’t put your domain in the From line and pass, because their SPF and DKIM belong to their domain, not yours.

It sets a policy. The p= tag tells receivers what to do when a message fails:

  • p=none: do nothing, just report. This is where everyone starts.
  • p=quarantine: send failing mail to spam.
  • p=reject: refuse failing mail outright.

It asks for reports. The rua= tag tells receivers where to send daily aggregate reports. They’re XML files listing every server that sent mail claiming to be your domain, how much it sent, and whether it passed SPF, DKIM and alignment.

A first DMARC record looks like this:

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

The raw XML is hard to read. A free or cheap DMARC report service turns it into a list of senders. If the reports go to an address at a different domain, that domain has to publish a small record allowing it, and most report services walk you through it.

Getting to p=reject without breaking your email

p=none protects nothing. It only watches. The goal is p=reject, where nobody else can send mail that claims to be you. Getting there safely is a matter of order.

  1. Publish p=none with rua= and wait two to four weeks. Let the reports build a full picture, including the monthly statement run and the newsletter that goes out once a quarter.
  2. List every legitimate sender. Read the reports. You’ll find your email provider, plus things you forgot about: the accounting system that emails invoices, the website contact form, the scanner in the office, the booking tool.
  3. Fix each one. For each legitimate sender, set up DKIM signing with your domain (best), or add it to SPF if it uses your domain in the Return-Path. Watch the 10-lookup limit as you add includes. A sender you no longer use is simply left off.
  4. Move to quarantine, gradually if you like. p=quarantine; pct=25 applies the policy to a quarter of failing mail. Raise it to 100 over a week or two while you watch the reports.
  5. Move to reject. When the reports show only legitimate senders passing, and the failures are all forgeries, change to p=reject.

The finished record:

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

Keep the reports coming after you reach reject. The day someone in your office signs up for a new email tool, the reports will show it failing, and you’ll know to set it up properly.

Domains that never send email

If you own spare domains, like the misspelling or the old business name, lock them down too. Scammers like unused domains because nobody is watching them. Three records tell the world they send no mail at all:

example.net.          TXT  "v=spf1 -all"
_dmarc.example.net.   TXT  "v=DMARC1; p=reject"
example.net.          MX   0 .

The last one is a “null MX,” which says the domain doesn’t accept mail either.

The short version

  • SPF lists who may send. One record, under 10 lookups.
  • DKIM signs each message. One selector per sending service, signed with your domain.
  • DMARC checks that the visible From domain matches, sets the policy, and sends you reports.
  • Start at p=none, read the reports, fix every real sender, then step up to p=reject.

If you’d like a second pair of eyes on your records, send us your domain name and we’ll tell you what we see.

Keep reading