TL;DR
Email authentication helps receivers check whether a message is allowed to use your domain. SPF identifies authorized sending services, and DKIM adds a signature that receivers can verify. DMARC connects those checks to the address readers see and requests reports about messages using it. Start with monitoring, fix your legitimate senders, then tighten the policy; authentication helps protect your domain but does not guarantee delivery.
You send an invoice and the client never sees it. It is in their spam
folder, or it bounced back with a line like 550 5.7.515 Access denied, sending domain does not meet the required authentication level. Or worse, email
spoofing: someone sends email that looks like it came from you, and your
customers believe it.
Three DNS records called SPF, DKIM, and DMARC provide email authentication, an important part of addressing these problems. They identify authorized sending services, check message signatures, and tell receivers how to handle mail that fails authentication. They do not guarantee inbox placement or stop lookalike-domain scams. Google reported that once it started requiring authentication, the number of unauthenticated messages Gmail users receive fell by 75% (Google, October 2023).
This guide sets them up in the right order, with the exact values for Google Workspace and Microsoft 365, and then moves your domain to a policy that blocks spoofing without blocking your own mail. To check the records afterwards, or to read one you already have, see my guide to checking DNS TXT records with nslookup and dig.
The SPF, DKIM, and DMARC records at a glance
| Record | Where it goes (host) | Example value | Where the value comes from |
|---|---|---|---|
| SPF | @ (the domain itself) | v=spf1 include:_spf.google.com ~all | Each sending service’s setup guide |
| DKIM | selector._domainkey | v=DKIM1; k=rsa; p=MIIBIjANBg... (or a CNAME) | Generated by each sending service |
| DMARC | _dmarc | v=DMARC1; p=none; rua=mailto:dmarc@example.com | You write it |
In plain words: an SPF record is a TXT record in your DNS that lists the servers allowed to send email for your domain. A DKIM record publishes the public key that receivers use to check the signature your mail server adds to each message. A DMARC record tells receivers what to do with mail that fails both checks, and where to send you reports about it.
SPF and DKIM prove a message is allowed. DMARC checks that whatever passed matches the domain people see in the From line, and tells receivers what to do when nothing does. That match is called alignment, and it is the part most setups miss.
Why you need SPF, DKIM, and DMARC now
The big mailbox providers have turned these records from good practice into requirements:
| Provider | Every sender | Bulk senders |
|---|---|---|
| Gmail (since February 1, 2024) | SPF or DKIM, spam rate under 0.3% | More than 5,000 messages a day to Gmail: SPF and DKIM, DMARC (p=none is enough), From domain aligned with SPF or DKIM, one-click unsubscribe for marketing mail |
| Yahoo | SPF or DKIM, spam rate under 0.3% | SPF and DKIM, a DMARC policy of at least p=none that passes, one-click unsubscribe, unsubscribes honored within 2 days |
| Outlook.com | 5,000 or more messages from one From domain: SPF and DKIM pass, a DMARC record (p=none at minimum), aligned with SPF or DKIM, or the mail is rejected with 550 5.7.515 |
A small business may never reach 5,000 messages a day. Your newsletter tool, your CRM, and your invoicing system, all sending as your domain, can. And even below the line, mail with all three records is simply easier for a receiver to trust.
Before you start: list everything that sends email as you
This is the step that decides whether the rest goes smoothly. Write down every system that sends email with your domain in the From address. A typical small business has more than it thinks:
- Your mailbox provider (Google Workspace, Microsoft 365, or your web host’s mail).
- A newsletter or marketing tool.
- A CRM, help desk, or booking system.
- Invoicing, accounting, or online store notifications.
- Your website’s contact form or WordPress notifications.
- A copier, scanner, or other device that emails documents.
Then find out where your DNS is hosted. It is not always where you bought the domain. Ask for the domain’s name servers:
nslookup -type=NS example.com
The answer names the provider whose dashboard you edit (Cloudflare, your registrar, your web host). Records added anywhere else are never seen.
In most DNS dashboards, the host or name field is relative to your domain:
enter @ for the domain itself and _dmarc (not _dmarc.example.com) for
DMARC. In Cloudflare, it is DNS, Records, Add record, then the
type, name, and content, and Save
(Cloudflare’s guide).
Step 1: Set up your SPF record
SPF is one TXT record on the domain itself that lists every service from
your inventory. The syntax of an SPF record is short: it starts with
v=spf1, lists mechanisms such as include:, ip4:, ip6:, a, and
mx, and ends with all behind a qualifier that says what to do with every
server not listed. Each service’s setup guide gives you an include: value (or
an IP address) to add. The two most common:
| Email provider | SPF record when it is the only sender |
|---|---|
| Google Workspace | v=spf1 include:_spf.google.com ~all |
| Microsoft 365 | v=spf1 include:spf.protection.outlook.com -all |
Add each other service’s value to the same record, before the all at the
end. A domain on Microsoft 365, with its own mail server and a booking tool,
looks like this:
v=spf1 ip4:203.0.113.25 include:spf.protection.outlook.com include:mail.bookingtool.example -all
Three rules keep SPF working:
- One SPF record per domain. Two TXT records that start with
v=spf1make every SPF check fail with a permanent error. When a new tool tells you to “add this SPF record”, merge itsinclude:into the one you have (RFC 7208). - No more than 10 DNS lookups, the SPF lookup limit. Each
include:,a,mx,exists, andredirectcosts a lookup, and so does every include inside the records you include.ip4:andip6:cost nothing. Past 10, SPF fails. - Choose the ending.
~all(soft fail) and-all(hard fail) both count as a fail for DMARC. Google suggests~allfor Workspace; Microsoft recommends-all, because with~allsome receivers ignore the DMARC policy for mail that also has no DKIM signature (Microsoft). Use what your provider suggests while you set up, and move to-allonce DMARC reports show every service passing. Never use+all.
Each subdomain that sends email needs its own SPF record: the one on
example.com does not cover news.example.com.
Step 2: Set up DKIM signing in every service
DKIM is the record that matters most. It survives forwarding, where SPF
breaks, and DMARC can rely on it alone. Each sending service creates its own
key pair: it keeps the private key, signs every message with it, and gives
you the public key to publish at selector._domainkey on your domain. The
DKIM selector is just a name the service picks, so several services can each
have their own key.
Use a 2048 bit key whenever you are offered a choice. The DKIM standard says signers should use at least 2048 bits and must use at least 1024 (RFC 8301), and Gmail rejects keys shorter than 1024.
Google Workspace DKIM setup
From Google’s guide, as a super administrator:
- In the Admin console, go to Menu, Apps, Google Workspace, Gmail, then Authenticate email.
- Pick your domain and choose Generate New Record. Select 2048 as
the key length (1024 only if your DNS host cannot store a long record)
and keep the default selector,
google. - Copy the DNS Host name (
google._domainkey) and the TXT record value (v=DKIM1; k=rsa; p=...), and add them as a TXT record at your DNS host. - Wait for the record to publish (Google allows up to 48 hours), then come back and choose Start authentication. Not before: Workspace starts signing at once, and signatures with no key in DNS fail.
Microsoft 365 DKIM setup
Microsoft hosts the keys itself and has you point two CNAME records at them, so it can rotate keys without you touching DNS again. From Microsoft’s guide:
- In the Microsoft Defender portal, go to Email & collaboration, Policies & rules, Threat policies, Email authentication settings, and open the DKIM tab.
- Select your domain. Its details panel lists the two CNAME values under Publish CNAMEs.
- At your DNS host, add two CNAME records:
selector1._domainkeyandselector2._domainkey, each pointing at the value shown. They look likeselector1-example-com._domainkey.example.n-v1.dkim.mail.microsoft. - After a few minutes, return to the panel and turn on Sign messages for this domain with DKIM signatures. The status changes to Signing DKIM signatures for this domain.
Without this, Microsoft 365 signs your mail with your onmicrosoft.com
domain, which does not align with your own domain and does not help DMARC.
DKIM in your other tools
Newsletter, CRM, and help desk tools usually call this “authenticate your domain” or “domain authentication” in their settings. They give you one to three records (TXT or CNAME) to add. Do it for every tool on your list: without it, the tool signs with its own domain, which passes DKIM but fails DMARC alignment. Many of these tools also offer a custom return path or bounce domain on a subdomain of yours, which makes SPF align as well.
Step 3: Set up a DMARC record in monitoring mode
Give SPF and DKIM time to work first; Google suggests 48 hours
(Google’s DMARC guide).
Then add one TXT record with the host _dmarc:
v=DMARC1; p=none; rua=mailto:dmarc@example.com
p=noneasks receivers to change nothing about delivery. This is the starting point because you cannot yet know what your list missed.rua=is where receivers send DMARC aggregate reports, one a day: which servers sent mail as your domain to participating receivers, how much, and whether it passed. Use a dedicated mailbox or group, not your own inbox. Google advises the same, and the reports arrive as compressed XML files, one per receiver per day.
Leave adkim and aspf out. Both default to relaxed alignment, which lets
mail from news.example.com count for example.com. Strict alignment
(s) breaks exactly the subdomain setups recommended above.
If you send the reports to a DMARC reporting service on another domain, that
domain has to publish a record authorizing it
(example.com._report._dmarc on the service’s domain). Reporting services
set this up for you; it is the reason reports to a friend’s or agency’s
address never arrive.
Step 4: Check that SPF, DKIM, and DMARC pass
You do not need an online SPF, DKIM, and DMARC checker for this. The
receiver’s own verdict is the one that counts, and Gmail shows it to you.
Send a message from each service on your list to a Gmail address you can
open (not to yourself). In Gmail, open the message, choose More next to
Reply, then Show original, and find the Authentication-Results line:
Authentication-Results: mx.google.com;
dkim=pass header.i=@example.com header.s=google;
spf=pass smtp.mailfrom=example.com;
dmarc=pass (p=NONE) header.from=example.com
You want dkim=pass with your own domain after header.i or header.d,
and dmarc=pass. SPF may pass for another domain (the service’s bounce
address), and that is fine as long as DKIM passes for yours. If DMARC fails
while SPF and DKIM both pass, the domains do not match the From address:
that service still signs with its own domain. Go back to Step 2 for it.
To look at the records themselves, use the commands in checking DNS TXT records, which also explains each tag.
Step 5: Move from p=none to quarantine and reject
p=none is a microscope, not a lock: it requests no DMARC-based blocking, though receivers can still filter spoofed mail. The
point of the first weeks is to read the DMARC aggregate reports until every
legitimate source passes. The raw XML is hard to read; a DMARC report
service (many have free tiers) turns it into a list of senders with their
pass and fail counts. For each source that fails:
- It is yours (your CRM, a forgotten form plugin): add it to SPF, turn on DKIM for it, or move it to a subdomain.
- You do not recognize it, and it fails everything: that is the email spoofing DMARC is about to stop. No action needed.
- It is a forwarder or mailing list: some failures here are normal. DKIM usually survives forwarding; SPF does not.
Then tighten the policy one step at a time. The current DMARC standard,
RFC 9989 (May 2026),
suggests p=none for at least a month, then p=quarantine for as long
again, comparing the results before going further:
v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com
v=DMARC1; p=reject; rua=mailto:dmarc@example.com
Should you go all the way to p=reject? The same standard is blunt about
two things. A domain that publishes p=reject must sign its mail with DKIM
rather than rely on SPF alone. And a domain whose people post to mailing
lists should not publish p=reject at all, because lists rewrite messages
in ways that break authentication, and the bounces can get the list’s other
subscribers removed. My rule of thumb: a domain that only sends from
systems (receipts, notifications, a store) can go to p=reject; a domain
your staff use for everyday email, mailing lists included, does well at
p=quarantine.
Older guides, including Microsoft’s and Google’s, roll out with a pct= tag
(apply the policy to 10%, then 25%, and so on). RFC 9989 removes pct,
because receivers applied it inconsistently, and adds t=y, a test flag
that asks receivers to reduce enforcement by one level: quarantine becomes
none, and reject becomes quarantine. Test mode with p=reject is not
monitoring-only. A leftover pct= does no
harm; newer receivers simply ignore it.
Your DMARC record also covers every subdomain that does not have its own,
including subdomains that do not exist. That is what stops someone sending
as billing.example.com. Add sp= only if subdomains need a different
policy from the domain.
Protect domains that never send email
Every domain you own can be spoofed, including the ones that only redirect to your website. For a domain that never sends mail, publish:
| Record | Host | Value |
|---|---|---|
| SPF (TXT) | @ | v=spf1 -all |
| DMARC (TXT) | _dmarc | v=DMARC1; p=reject; |
| Null MX (MX) | @ | priority 0, mail server . |
The SPF record says no server may send for the domain, DMARC tells receivers to reject anything that tries, and the null MX record (RFC 7505) says the domain accepts no mail. Do not publish DKIM keys for it: with no key, no forged signature can pass (Microsoft).
Common SPF, DKIM, and DMARC mistakes
| Mistake | What happens | Fix |
|---|---|---|
A second v=spf1 record added for a new tool | SPF fails for every message | Merge into one record |
| More than 10 lookups in SPF | SPF fails with a permanent error | Remove old services, use ip4:, move tools to a subdomain |
| DKIM left on the tool’s own domain | DKIM passes, DMARC fails | Authenticate your domain in the tool |
| Workspace Start authentication before the key is in DNS | DKIM fails until the record publishes | Add the TXT record first, then start |
_dmarc.example.com typed into the host field | The record lands on _dmarc.example.com.example.com | Enter only _dmarc |
| Reports sent to a personal inbox | The inbox fills with XML nobody reads | A dedicated mailbox or a report service |
Jumping straight to p=reject | Invoices and newsletters from a forgotten tool bounce | p=none first, read the reports |
Strict alignment (adkim=s; aspf=s) copied from an example | Subdomain senders fail DMARC | Leave both tags out (relaxed) |
A setup checklist
- List every service that sends email as your domain.
- Find your DNS host with
nslookup -type=NS. - Publish one SPF record that includes every service.
- Turn on DKIM, with a 2048 bit key, in every service, and publish each key.
- Wait 48 hours, then add
v=DMARC1; p=none; rua=mailto:...at_dmarc. - Send a test from each service to Gmail and check
Authentication-Resultsfordkim=passanddmarc=pass. - Read the reports for at least a month; fix every source that is yours.
- Move to
p=quarantine, wait as long again, then decide onp=reject. - Lock down every domain that does not send email.
These three records protect the mail your domain sends. The site the domain points at needs its own defences, and on WordPress that starts with the best WordPress security plugin and what it can and cannot do.
Sources
Frequently asked questions
What is the difference between SPF, DKIM, and DMARC?
SPF lists the servers allowed to send email for your domain. DKIM adds a signature to each message that receivers check against a public key in your DNS. DMARC ties the two to the address people see in the From line, tells receivers what to do with mail that fails, and sends you reports.
Do I need all three?
Set up all three for a complete domain-authentication policy. Gmail accepts SPF or DKIM from ordinary senders and requires both plus DMARC for bulk senders. Requirements vary by provider. DMARC asks receivers how to handle unauthenticated use of your domain; it does not prevent someone sending a forged message or guarantee inbox placement.
Does DMARC stop email spoofing?
Yes, for mail that puts your exact domain in the From line, once your policy is p=quarantine or p=reject and the receiver honors it. It does nothing about lookalike domains or a forged display name over a different address, so people still need to read the sender address.
Why are my emails still going to spam after setting up SPF, DKIM, and DMARC?
Authentication is the first requirement, not the only one. Gmail and Yahoo also want a spam complaint rate under 0.3%, a one-click unsubscribe on marketing mail, and a sending domain with some history. Check the Authentication-Results header first: if all three pass, the cause is reputation or content, not DNS.
In what order should I set up SPF, DKIM, and DMARC?
SPF first, then DKIM, then DMARC. DMARC reads the results of the other two, so set them up and wait for them to work before you add it. Google suggests waiting 48 hours after SPF and DKIM before adding DMARC.
What DMARC policy should I start with?
Start with p=none and a rua address for reports: v=DMARC1; p=none; rua=mailto:dmarc@example.com. It requests no DMARC-based quarantine or rejection and can produce reports from participating receivers. Other spam and security checks still apply. Move to p=quarantine only after the reports show your own mail passing.
How long does it take for SPF, DKIM, and DMARC to work?
The records work as soon as receivers can see them, which is often within minutes. Google allows up to 48 hours for SPF and for DKIM to start working, because resolvers may cache old answers. Plan on a month or more of reports before you tighten the DMARC policy.
Can I have more than one SPF record?
No. A domain must have exactly one TXT record that starts with v=spf1. Two of them make SPF return a permanent error for every message. Merge every service into one record with a single all at the end.
Should I use -all or ~all in my SPF record?
-all or ~all in my SPF record?Either works with DMARC, which treats both as a fail. Google suggests ~all for Workspace and Microsoft recommends -all for Microsoft 365. Start with what your email provider suggests and move to -all once your DMARC reports show every service you use passing.
Is p=none enough?
p=none enough?It meets the minimum DMARC policy requirement in those providers' bulk-sender rules, but requests no quarantine or rejection on DMARC grounds. Receivers can still block or filter mail independently. Use it to learn who sends as your domain, then move to p=quarantine or p=reject to stop spoofing.
What does no DMARC record found mean?
A checker or a receiver looked up the TXT record at _dmarc.yourdomain and found nothing. Add one, starting with v=DMARC1; p=none; rua=mailto:dmarc@example.com. If you already did, check that the host field holds only _dmarc, not _dmarc.yourdomain, and give DNS time to publish it.
What does DMARC policy not enabled mean?
Checkers such as MXToolbox show this warning when your DMARC record exists but its policy is p=none, which quarantines or rejects nothing. That is the right state while you read your reports. Move to p=quarantine or p=reject once every source you own passes, and the warning goes away.
What records should a domain that never sends email have?
An SPF record of v=spf1 -all, a DMARC record of v=DMARC1; p=reject; at _dmarc, and optionally a null MX record (priority 0, value .) to say it accepts no mail. Do not publish DKIM keys for it.