If your emails land in spam, or if someone is sending messages that pretend to come from your domain, three small DNS records are usually at the heart of it: SPF, DKIM and DMARC. They have confusing names and a reputation for being hard, but each answers a simple question, and together they've become close to compulsory.
The three questions
- SPF asks: is this server allowed to send mail for this domain?
- DKIM asks: was this message signed by the domain, and has it been tampered with?
- DMARC asks: what should I do when the first two checks fail, and who should be told?
None of them stops spam by itself. They give receiving servers a reliable way to decide whether a message is genuinely yours, and that's what gets legitimate mail delivered and forged mail rejected.
SPF: the list of permitted senders
An SPF record is a TXT record at your domain that lists the servers allowed to send on your behalf:
example.com. IN TXT "v=spf1 include:_spf.google.com ip4:203.0.113.25 ~all"
Read it left to right. include pulls in another provider's approved list, ip4 allows a specific address, and the ending says what to do with everybody else: ~all is a soft fail ("probably not us") and -all is a hard fail ("definitely not us"). Never end with +all, which means anyone may send as you.
Two limits cause most SPF breakage. You can have only one SPF record per domain, and a check may trigger no more than ten DNS lookups in total, counting every include along the way. Add a few email services and you'll hit it without noticing, at which point SPF silently becomes an error. The record Google Workspace customers include, _spf.google.com, was a single flat list of address ranges when we looked, which is exactly how providers keep customers under the limit.
DKIM: a signature on every message
With DKIM, your mail server signs each outgoing message with a private key. The matching public key sits in DNS at a name made from a selector you choose:
selector1._domainkey.example.com. IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkq..."
The receiver reads the selector from the message header, fetches the key and checks the signature. If it matches, the message is proven unchanged and tied to your domain. Use 2048-bit keys where your provider allows it, and remember that each service you send from (your mailbox, your newsletter tool, your help desk) normally has its own selector and key.
DMARC: the policy and the reports
DMARC lives at _dmarc.yourdomain.com and ties the other two together. It requires that SPF or DKIM passes and aligns with the visible "From" address, then tells receivers what to do otherwise:
_dmarc.example.com. IN TXT "v=DMARC1; p=none; rua=mailto:dmarc@example.com"
The p tag takes three values: none (monitor only), quarantine (send to spam) and reject (refuse outright). The rua address receives daily summary reports showing who sent mail as you, which is how you discover the forgotten systems that need fixing. You can look any domain up in our DMARC checker.
Soft fail or hard fail?
People argue about ~all versus -all, and the practical answer is that it matters less than you'd expect. Receivers lean on DKIM and DMARC results as well, and a hard SPF fail can reject legitimate mail that a forwarder has relayed, because forwarding changes the sending IP and breaks SPF. Starting with ~all and letting DMARC do the real enforcement is a perfectly reasonable setup. Subdomains deserve a thought too: if you never send mail from them, a DMARC sp=reject tag stops anyone else abusing them.
Why it matters more than it used to
Since February 2024, Google and Yahoo have required senders of bulk mail (about 5,000 messages a day or more to their users) to authenticate with SPF and DKIM, publish a DMARC policy and offer easy unsubscribing. Microsoft introduced similar requirements for high-volume senders to its consumer mailboxes, Outlook.com among them, in May 2025. Even small senders benefit, because unauthenticated mail is increasingly treated with suspicion by default.
A rollout order that doesn't break anything
- List every sender. Your mailbox provider, newsletters, billing software, CRM, website forms. Skipping one means its mail will fail later.
- Publish SPF with all of them in a single record.
- Turn on DKIM for each service and publish the keys it gives you.
- Add DMARC with
p=noneand a reporting address. Leave it for two to four weeks. - Read the reports and fix any legitimate source that fails.
- Move to
quarantine, ideally ramping up with thepcttag, then torejectonce the reports stay clean.
Going straight to reject on day one is the classic mistake: you'll bounce your own invoices.
Common errors we see
- Two SPF records instead of one.
- More than ten SPF lookups.
- A DKIM key published in the wrong place, often because a provider's hostname got the domain appended twice.
- A DMARC record on the wrong name, for instance
dmarc.example.comrather than_dmarc.example.com. - A
ruamailbox that nobody reads, or one that fills up and bounces reports.
Testing and the other half of deliverability
After publishing, check the TXT records are visible worldwide with the DNS checker, and send a message to a mailbox you control: the original headers show SPF, DKIM and DMARC results. Authentication is only part of reputation, though. Your sending IP also needs a sensible reverse DNS record and a clean record on the blacklists. And if you're unsure what a TXT record is in the first place, start with our guide to DNS record types.