← All posts

SPF, DKIM and DMARC explained in plain English

SPFDKIMDMARC

If your emails land in spam, or someone is sending mail pretending to be you, the cause is almost always the same three DNS-based standards: SPF, DKIM and DMARC. Here is what each one does.

SPF: who may send

SPF (Sender Policy Framework) is a DNS TXT record listing the servers allowed to send mail for your domain. A receiving server checks the sending IP against that list.

example.com. TXT "v=spf1 include:_spf.google.com ~all"
  • Only one SPF record per domain. Two records is an error.
  • SPF allows at most 10 DNS lookups. Every include: counts, so long lists break.
  • ~all is a soft fail, -all a hard fail.

DKIM: was it altered

DKIM (DomainKeys Identified Mail) signs each message with a private key. The matching public key sits in DNS under a selector, so receivers can verify that the message really came from your domain and was not changed in transit.

selector1._domainkey.example.com. TXT "v=DKIM1; k=rsa; p=MIIBIjANBg..."

Each sending service (your mail provider, newsletter tool, CRM) usually has its own selector.

DMARC: what to do when checks fail

DMARC ties SPF and DKIM to the visible From: domain (this is called alignment) and tells receivers what to do with mail that fails. It also asks them to send you reports.

_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:[email protected]"
Policy Meaning
p=none Monitor only, take no action
p=quarantine Send failing mail to spam
p=reject Reject failing mail

The order to set them up

  1. Publish SPF for every service that sends as your domain.
  2. Enable DKIM signing for each of those services.
  3. Add DMARC with p=none and a rua address, and read the reports for a few weeks.
  4. Fix any legitimate sender that fails, then move to quarantine and finally reject.

Skipping the monitoring step is the most common way to accidentally block your own mail.