These three DNS records decide whether your mail is delivered and whether strangers
can send invoices in your name. Do them in this order, and do not skip the monitoring
phase — going straight to enforcement is how people lose a fortnight of email.
Step 1 — SPF: who is allowed to send as you
One TXT record on your root domain. One only — two SPF records is itself an error
and causes both to fail.
Type: TXT
Host: @ (your root domain)
Value: v=spf1 mx a:mail.example.com include:_spf.google.com -all
Read it left to right: allow the servers in my mx record,
allow mail.example.com, allow whatever Google publishes,
and -all means reject everything else. Use
~all (soft fail) for the first fortnight if you are nervous,
then tighten to -all.
Watch the ten-lookup limit. Every include:
costs a DNS lookup, and SPF permanently fails above ten. If you use several senders —
Microsoft, a CRM, a newsletter tool — you will hit it faster than you expect.
Step 2 — DKIM: sign what you send
Your mail server generates a key pair, keeps the private half, and you publish the
public half. The selector (default below) is chosen by
whoever generates the key.
Type: TXT
Host: default._domainkey
Value: v=DKIM1; h=sha256; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A...
Use a 2048-bit key. Some DNS panels will not accept a value that long in one
field and require it split into quoted chunks — that is a formatting quirk of the
panel, not of DKIM.
The failure mode nobody catches: a mail server configured to sign
with a key whose public half was never published. Every message then carries a
signature that cannot be verified, which is worse than not signing at all. Check with
our domain checker after any mail migration.
Step 3 — DMARC: say what to do when the first two fail
Start at p=none. This changes nothing about delivery — it
only asks receivers to send you reports. Leave it for two to four weeks and read them.
Type: TXT
Host: _dmarc
Value: v=DMARC1; p=none; rua=mailto:dmarc@example.com; fo=1; pct=100
Once the reports show your legitimate mail passing, tighten in two moves:
v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com; pct=100
v=DMARC1; p=reject; rua=mailto:dmarc@example.com; pct=100
p=reject is the destination. Anything less and a forgery
may still land in someone's inbox. Add adkim=s; aspf=s for
strict alignment once you are confident.
Order matters. SPF and DKIM first, verified working. Then DMARC at
p=none and read the reports. Only then enforce. Publishing
p=reject on day one, before your senders are listed, will
bin your own invoices.