SPF, DKIM and DMARC: email authentication explained

How SPF, DKIM and DMARC work together to stop spoofed email, how to read the records, and the most common mistakes.

Email was designed in a time when everyone trusted each other. The original protocol lets any server claim to send mail from any address – which is why phishing mails can appear to come from your bank. SPF, DKIM and DMARC are three DNS-based mechanisms that let a domain owner say which mail is genuine and what receivers should do with the rest. Large providers such as Gmail and Yahoo now require them from bulk senders, and missing records are a common reason for mail ending up in spam.

SPF – which servers may send

SPF (Sender Policy Framework) is a TXT record on the domain that lists the servers allowed to send mail using the domain in the envelope sender (the "Return-Path" address). A typical record looks like this:

v=spf1 include:_spf.google.com include:spf.protection.outlook.com ip4:203.0.113.25 -all

Common SPF mistakes – which webstriker checks for:

DKIM – a signature on every message

DKIM (DomainKeys Identified Mail) lets the sending server sign each message with a private key. The matching public key is published in DNS under a selector: <selector>._domainkey.example.com. The receiver reads the selector from the DKIM-Signature header of the message (the s= tag), fetches the key and verifies that the message has not been changed and really was signed for that domain.

Because the selector name is chosen by the sender, there is no way to list all DKIM keys of a domain. webstriker tries the most common selectors – google for Google Workspace, selector1 and selector2 for Microsoft 365 (these are CNAMEs pointing to Microsoft), k1 for Mailchimp, default, s1/s2 and a few others. If none is found, look at the headers of an email from the domain to find the real selector.

Unlike SPF, a DKIM signature survives forwarding, which makes it the more robust of the two.

Advertisement

DMARC – tying it together and setting a policy

SPF and DKIM on their own have a gap: they validate the envelope sender or the signing domain, which need not match the From address the recipient actually sees. DMARC closes that gap. It requires that at least one of SPF or DKIM passes and is aligned with the domain in the From header. It also lets you tell receivers what to do when a message fails, and where to send reports.

The record lives at _dmarc.example.com:

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

A safe way to roll it out

  1. Publish one correct SPF record that covers all services sending as your domain.
  2. Enable DKIM signing with your domain in every service that supports it (Microsoft 365, Google Workspace, newsletter tools, and so on).
  3. Publish DMARC with p=none and a rua address. Read the reports for a few weeks – a free or paid DMARC report service makes the XML readable.
  4. When all legitimate mail passes, move to p=quarantine, and later to p=reject.

The extras: MTA-STS, TLS-RPT and BIMI

Run a webstriker lookup on your domain to see all of these in the "Email" section of the report.

Try it yourself:
Advertisement

More guides