Back to Lessons
Intermediate
14 min

SPF, DKIM, DMARC: The Bouncers for Your Domain

Anyone can send a message claiming to be accounts@yourbusiness.com.au. These three DNS records tell the rest of the internet which mail is really yours.

SPFDKIMDMARCRFC 9989Email authentication

The problem: email trusts everyone

Email was designed in an era when the internet was a few universities that trusted each other. Out of the box, anyone can send a message claiming to be your domain. The three records are SPF (RFC 7208), DKIM (RFC 6376), and DMARC (RFC 9989, May 2026; replaces RFC 7489). ACSC email security guidance is the local reference for the same trio.

Think of a nightclub. SPF is the guest list, DKIM is the wristband that cannot be faked, and DMARC is the bouncer's policy for anyone who does not have either.

SPF: the guest list

SPF (Sender Policy Framework) is a TXT record in your DNS listing the servers allowed to send mail for your domain.

v=spf1 include:spf.protection.outlook.com include:_spf.google.com -all
  • include: adds a provider's servers (Microsoft 365, Google, Xero, your newsletter tool).
  • -all means “everyone else fails.” ~all is a softfail, a gentler maybe.

Catch: SPF allows at most 10 DNS lookups. Each include can count several times. Go over the limit and SPF breaks completely (a permerror). Small businesses hit this all the time after adding their fifth SaaS tool.

DKIM: the wax seal

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to every message. The public key sits in your DNS, and receivers use it to check that the message really came from your systems and was not changed on the way.

You do not write DKIM by hand. Your email provider generates the key and tells you which DNS record to add. Google Workspace gives you one TXT record. Microsoft 365 uses two CNAMEs, called selectors. Turn it on in Microsoft 365 or Google Workspace admin, add the records, and check it shows as active.

DMARC: the bouncer's policy

DMARC ties the other two together. It tells receivers: if a message claiming to be from my domain fails SPF and DKIM alignment, here is what to do with it, and please send me reports.

_dmarc.yourbusiness.com.au  TXT  "v=DMARC1; p=none; rua=mailto:dmarc@yourbusiness.com.au"
  • p=none: monitor only and change nothing (yet).
  • p=quarantine: send failures to spam.
  • p=reject: block failures completely.
  • rua=: where daily aggregate reports go.
  • t=y: testing mode. Receivers treat a stricter policy one step softer while you check nothing legitimate breaks. The old pct= tag was removed in RFC 9989, so do not rely on it.

Alignment means the domain in the visible From: address has to match the domain SPF or DKIM checked. That is the part that stops someone spoofing exactly your address.

The rollout (do not skip steps)

Going straight to p=reject is how you find out your payroll system sends email for you, at the end of the month, with a phone full of angry staff.

  1. Inventory. List everything that sends email as your domain: your mailbox provider, accounting software, CRM, website contact form, newsletter platform.
  2. Get SPF and DKIM working for each of them.
  3. Publish p=none with a rua address. Use a free or cheap DMARC report viewer, because raw reports are XML and nobody enjoys reading them.
  4. Watch for 2–4 weeks. Fix any legitimate senders that are failing.
  5. Move to p=quarantine, with t=y first if you want a safety net, then drop t=y once reports stay clean.
  6. Move to p=reject once the reports are clean.

If you are on a domain you do not send email from at all (a parked domain), publish v=spf1 -all and p=reject straight away. Nobody should be sending from it, including attackers.

Check your own domain

Use read-only lookup tools such as MXToolbox, or your provider's admin checks, to see what is published for your domain. They only read public DNS. Look for:

  • Exactly one SPF record (two is an error).
  • DKIM showing as enabled.
  • A DMARC record, and what policy it is at.

Common pitfalls

Two SPF records
Merge them into one.
Too many lookups
Remove services you no longer use. Consider SPF flattening carefully.
Parking at p=none forever
Monitoring is step one, not the finish line. A lot of domains have sat at p=none for years.
Forgetting senders
Subdomains and third-party tools count. That newsletter platform has to be set up too. And somebody has to actually read the reports, or send them somewhere that summarises them.

Check yourself

  1. 1. Which record lists the servers allowed to send for your domain?
  2. 2. What does p=quarantine do?
  3. 3. Why not start with p=reject?
  4. 4. Your SPF record has 14 lookups. What happens?
Answers

1 — SPF. 2 — failing mail goes to spam. 3 — you will block your own legitimate senders. 4 — SPF fails (permerror).

Wrap

SPF lists who can send, DKIM proves it, and DMARC enforces it and reports back. Roll it out slowly and you make your domain much harder to impersonate, which helps a lot against the invoice scam.

Adapted from Apache-2.0 licensed source material (mukul975/Anthropic-Cybersecurity-Skills).