A hands-on guide to authenticating your own domain: publish SPF, DKIM and DMARC in the right order, keep your sending IPs off blocklists, and verify every layer actually passes.
This is a hands-on setup guide: how to publish SPF, DKIM and DMARC for a domain you send mail from, keep your sending IPs off RBL blocklists, and verify that everything actually works. If you first want the plain-language theory of what each mechanism is, read any general “how email authentication works” primer — here we focus on the records you create, the order you roll them out in, and the mistakes that break real mail.
TXT records) — usually your registrar or DNS host.SPF is a single TXT record on the root of your domain listing the servers allowed to send for it. The rule that trips everyone up: a domain may have only one SPF record. If you use several senders, you merge them into one line with multiple include: mechanisms — you do not publish two SPF records.
A typical record for a domain that sends through Google Workspace plus one marketing tool:
example.com. IN TXT "v=spf1 include:_spf.google.com include:sendgrid.net -all"
| Piece | Meaning |
|---|---|
include:_spf.google.com | Authorize a provider’s whole sending range by reference. Get the exact token from each sender’s docs. |
ip4: / ip6: | Authorize your own mail server by its public IP, e.g. ip4:203.0.113.10. |
~all vs -all | ~all = softfail (start here while testing); -all = hardfail (switch to it once the list is complete). |
The 10-lookup limit. SPF allows at most 10 DNS lookups while it is being evaluated; each include: and a/mx mechanism can cost one or more. Exceed it and SPF returns permerror — treated as a failure. If you stack many providers, drop unused includes or use an SPF-flattening service rather than piling on more.
Start soft, then harden. Publish with ~all for a week or two, confirm no legitimate sender fails, then change the final mechanism to -all.
DKIM adds a cryptographic signature to every message. You rarely build the key by hand — each sending platform generates it and gives you a TXT (or CNAME) record to publish under a selector. Do this per sender: Google, Microsoft, your ESP and your own server each get their own selector and key.
google, s1) and a public key.<selector>._domainkey.example.com. Providers that use a CNAME let them rotate the key for you — prefer that when offered.DKIM-Signature: header. Prefer a 2048-bit key where you can choose.Because the signature travels inside the message, DKIM survives forwarding (unlike SPF) — which is exactly why the next step leans on it.
DMARC ties SPF and DKIM to the visible From: address and tells receivers what to do on failure. Never start at p=reject — you will bounce your own legitimate mail from a sender you forgot. Roll it out in three stages, watching the reports between each.
| Stage | Record at _dmarc.example.com | Purpose |
|---|---|---|
| 1. Monitor | v=DMARC1; p=none; rua=mailto:dmarc@example.com | Change nothing for recipients; just collect aggregate reports of who sends as you. |
| 2. Quarantine | v=DMARC1; p=quarantine; pct=25; rua=… | Send a fraction of failing mail to spam. Raise pct as you gain confidence. |
| 3. Enforce | v=DMARC1; p=reject; rua=…; sp=reject | Reject spoofed mail outright. sp= sets the policy for subdomains. |
The rua= address receives daily XML aggregate reports from receivers. Read them (a free DMARC report viewer is enough at first): each one lists the sending IPs using your domain and whether they passed SPF and DKIM with alignment. Alignment is the catch — a message must not merely pass SPF or DKIM, the passing domain has to match the From: domain. If a legitimate service passes DKIM for its own domain but not yours, fix it by publishing that service’s DKIM under your domain (Step 2) before you move to enforcement.
SPF/DKIM/DMARC prove identity; RBL blocklists (DNSBLs) judge reputation of the sending IP. A perfectly authenticated message still lands in spam if its IP is listed. You do not publish anything for RBLs — you keep clean of them:
If you do get listed, most reputable lists (Spamhaus and others) show why and offer self-service delisting once the cause is fixed. Fix first, then request removal — delisting while the problem persists just gets you relisted.
Publishing records is not proof. Confirm each layer:
dig TXT example.com, dig TXT google._domainkey.example.com, dig TXT _dmarc.example.com (or nslookup -type=TXT on Windows).Authentication-Results: header — it states spf=pass, dkim=pass and dmarc=pass (or the exact failure) as the receiver saw it. That is the ground truth.p=none to enforcement.| Symptom | Usual cause & fix |
|---|---|
SPF permerror | Two SPF records, or more than 10 DNS lookups. Merge into one record; trim unused include:s. |
| Legit mail fails SPF | A sender you forgot to authorize, or the mail was forwarded. Add the sender; rely on DKIM+DMARC alignment for forwarding. |
DKIM fail (body hash) | Something rewrote the message in transit (a mailing list footer, an appliance). Sign with relaxed canonicalization; exclude volatile headers. |
| DMARC fails despite SPF/DKIM pass | No alignment — the passing domain isn’t your From: domain. Publish that sender’s DKIM under your own domain. |
| Subdomains get spoofed | No subdomain policy. Add sp=reject to the DMARC record. |
Once all three records are live, aligned and verified — and your IPs stay off the blocklists — you have closed the door on people spoofing your domain and given your real mail the best possible shot at the inbox. To sanity-check individual addresses on any domain, the email checker on the home page runs the live mailbox checks for you.