Set Up SPF, DKIM and DMARC in the Right Order
Publish one SPF record, switch DKIM on at every sender, then add DMARC at p=none. The order that authenticates a business domain without losing mail.

The short answer
Set the three records up in this order: SPF first, DKIM second, DMARC last, and start DMARC at p=none.
The order is not a matter of taste. DMARC does not authenticate anything itself. It reads the results of SPF and DKIM and tells receivers what to do when neither of them passes for the domain in your From address. Publish a DMARC policy before SPF and DKIM are working for every system that sends as you, and you have instructed the whole internet to act on failures you have not found yet.
Microsoft's own guidance follows the same sequence: publish an SPF record covering the sources you know about with the soft fail ending, discover the rest, tighten to hard fail, set up DKIM signing, and only then set up DMARC with a reporting address. That is also the order below.
Budget an afternoon for the records and two to four weeks of DMARC reports before you enforce anything. The afternoon is DNS work. The weeks are not optional, because those reports are the only complete list you will ever get of the systems that send mail as your domain, including the ones nobody remembers signing up for.
If your mail is already in trouble and you are here to stop it, start with why business emails go to spam instead, which is a diagnosis rather than a setup. This page assumes you want the three records done properly, whether or not anything is currently broken.
Step 0: list every sender before you touch DNS
This is the step people skip, and it is the step that decides whether the rest works. Every system that sends mail showing your domain in the From address has to be accounted for in SPF or DKIM. Miss one, and the day you move DMARC to enforcement, that one stops arriving.
Write the list on paper. In a small business it is usually longer than expected:
- Your mailbox provider. Google Workspace, Microsoft 365, Zoho Mail, or mail that comes with your hosting.
- Your website. Contact forms, order confirmations, password resets, anything the application sends. Often a different path from your mailbox, which is the whole subject of contact form emails going to spam.
- Your newsletter tool. Mailchimp, Brevo, Zoho Campaigns.
- Invoicing and accounting. Zoho Books, Tally integrations, anything that emails a PDF invoice to a customer.
- CRM and helpdesk. Anything that replies to a customer with your address on it.
- Booking, payroll, e-signature, support chat. The long tail. These are the ones that break later.
Two places to find the senders you have forgotten. Search your own sent and archived mail for your domain name in the From field across the last year. Then open your website's mail settings, because a transactional sender configured by a developer three years ago will not appear anywhere else.
Where your DNS actually lives
All three records are DNS records, so you need the panel that is authoritative for your zone, not the one you happen to have a login for. Those are often different: a domain bought at one registrar, nameservers pointed at a host, and a third panel left over from an old site.
Look up the NS records for your domain with the DNS checker. Whatever answers there is the panel that matters. If the nameservers point somewhere nobody in the business controls, that is the first problem to solve, and getting your website back from a previous developer covers it. Nothing below is possible without write access to the live zone.
Step 1: one SPF record, ending in soft fail
SPF is a single TXT record at the root of your domain that lists the servers allowed to send mail for it. One record. Not one per provider.
The include values for the common providers
A record is built from your providers' own include values, joined into one line:
v=spf1 include:_spf.google.com ~allv=spf1 include:spf.protection.outlook.com ~allFor Zoho Mail, Zoho documents include:zohomail.com, or include:one.zoho.com when you use several Zoho services. Combining a mailbox provider with a newsletter tool and a transactional sender looks like this:
v=spf1 include:_spf.google.com include:servers.mcsv.net include:sendgrid.net ~allThe host or name field for that record is the root of the domain, which most panels want written as @. Take every include value from the provider's own documentation on the day you do this, never from a blog post, because they change.
The rule that catches most people: a domain may publish exactly one SPF record. RFC 7208 section 4.5 says that when a lookup returns more than one matching record, the result is a permanent error, which means SPF fails for every message you send. Adding a provider means editing the existing record, not adding a second one, and plenty of provider setup wizards will happily add a second one for you.
The ten lookup budget
SPF has a spending limit that nobody tells you about until you cross it. The same RFC, section 4.6.4, requires receivers to limit the record to ten terms that cause a DNS query. Over that, the result is a permanent error again.
What counts against the ten: include, a, mx, ptr and exists mechanisms, and the redirect modifier. What does not count: all, ip4, ip6 and the exp modifier. The trap is that an include pulls in somebody else's record, and their lookups count against your ten as well. A single include:_spf.google.com is three lookups by itself.
There is a second, quieter limit in the same section: receivers should allow at most two void lookups, meaning queries that come back empty or with no such domain. An include for a service you stopped using two years ago is a void lookup, which is one good reason to prune the record rather than keep appending to it.
So when you build the record, prefer ip4: entries for your own fixed server addresses, since they are free, and drop includes for services you no longer use. Our DMARC and SPF checker does not count lookups, so if your record carries five or more includes, run it through a dedicated SPF lookup counter as well.
One more detail for long records. A single TXT character string is capped at 255 characters, and section 3.3 of the same RFC says multiple strings in one record are joined with no space added between them. Good DNS panels split a long value for you. Bad ones truncate it silently, so read the record back after saving.
Soft fail or hard fail
~all is soft fail: mail from a server not on the list is accepted but marked. -all is hard fail: it should be rejected.
Start at ~all. Microsoft's email authentication guidance says the same thing, and adds the reason: companies do not publish SPF records because they do not know all of their own sending sources. Publish soft fail for what you know, find the rest, then move to -all. On a domain with the list from step 0 genuinely complete, -all is better, and you can move to it in the same month.
Verify it
Enter the domain in the DMARC and SPF checker. It reads live DNS, reports whether exactly one SPF record exists, shows the record it found, and reads the ending. A second SPF record is reported as a failure with both records quoted, so you can see which to delete.
One thing SPF does not do: subdomains do not inherit it. Microsoft's guidance is explicit that each domain and each subdomain needs its own record. If your application sends from mail.yourdomain.com, that name needs its own SPF record.
Step 2: DKIM, one key for every sender
DKIM signs each message with a private key held by the sending system, and receivers verify the signature against a public key you publish in DNS at selector._domainkey.yourdomain.com.
DKIM matters more than SPF for the long run, for one reason: the signature travels with the message. When mail is forwarded, SPF breaks, because the forwarding server was never on your list. The DKIM signature survives, as long as nothing modifies the message. If you only ever get one of the two working properly, make it DKIM.
Google Workspace
Google generates the key for you in the Admin console. Per Google's DKIM instructions, the default key length is 2048 bits, with 1024 available for domain providers that cannot accept the longer value, and the default selector prefix is google, which Google recommends keeping. The TXT record host is the selector followed by ._domainkey, so google._domainkey.
Two timings to plan around, both from the same page. After enabling Gmail for your organisation you have to wait 24 to 72 hours before the DKIM key is available to retrieve. After you add the key to DNS, DKIM authentication can take up to 48 hours to start working.
The sequence is therefore: generate the key, publish the TXT record, wait, and then switch on signing in the console. Not the other way round.
Microsoft 365
Microsoft 365 uses two CNAME records rather than a TXT record, at the hostnames selector1._domainkey and selector2._domainkey. Two selectors exist so that keys can be rotated without a gap.
The target values are specific to your tenant, and the format changed. Microsoft's DKIM configuration guide documents a format for custom domains introduced in May 2025 that ends in -v1.dkim.mail.microsoft, while existing custom domains and initial domains still use the older form ending in .onmicrosoft.com. The old and the new format cannot coexist for the same selector, so do not copy either shape out of a guide. Read your actual values from the DKIM tab of the Email authentication settings page in the Defender portal, or run Get-DkimSigningConfig in Exchange Online PowerShell:
Get-DkimSigningConfig -Identity yourdomain.com | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAMEThen the part that is missed most often. Publishing the CNAME records does not switch signing on. Before you start, the domain shows a Toggle value of Disabled and a Status of NoDKIMKeys. You publish the two records, Microsoft detects them, and then you set the toggle to Enabled yourself. Until you do, mail from your custom domain is not signed with your domain.
Mail sent from the initial onmicrosoft.com domain is signed automatically and needs nothing, which is why a quick test from a tenant can look fine while the custom domain is unsigned. Test with the address your customers actually see.
If you create the signing configuration in PowerShell rather than the portal, note that the KeySize parameter defaults to 1024 and 2048 is available. Ask for 2048.
Zoho Mail and every other sender
Every system on your step 0 list needs its own DKIM key, published at its own selector. Newsletter tools, invoicing tools and helpdesks all call this the same few things in their settings: domain authentication, verified sending domain, custom DKIM, or branded domain. Each one hands you a record to publish, usually a CNAME.
This is the single highest-value hour in the whole exercise, and here is why. Left at the default, a sending service puts your address in the From header and signs the message with its own domain. SPF passes for the service. DKIM passes for the service. DMARC fails for you, because neither passing domain matches yours. Our post on how to check a DMARC record walks through reading exactly that failure in a real message header. Setting up domain authentication inside each tool is what fixes it, and nothing you publish on your own domain can substitute for it.
Verify it
Use the DKIM checker with your domain and the selector from the provider: google for Google Workspace, selector1 or selector2 for Microsoft 365, k1 for Mailchimp, s1 for SendGrid. If you do not know the selector, send yourself a message from that system and read the s= tag inside its DKIM-Signature header. A record that exists but carries an empty p= value means the key was revoked or saved wrongly, and you need a fresh one from the provider.
Step 3: DMARC at p=none, with an address somebody reads
Now the record that ties the other two to your visible From address. It is one TXT record at the name _dmarc in front of your domain. The safe first version, with a mailbox you control in place of the placeholder:
v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.comThat is the whole thing on day one. p=none asks receivers to take no special action on failures and to send you reports, which is exactly what you want while you are still finding senders.
A few things worth knowing from the current specification, RFC 9989, which replaced the older RFC 7489 in 2026:
v=DMARC1must come first. A record that does not start with it is ignored.p=is now optional and a syntactically valid record without it is treated asp=none. Publish it explicitly anyway, so that what you intended is visible to the next person who reads the zone.- Alignment defaults to relaxed for both
adkimandaspf, which means a subdomain aligns with its organisational domain. Leave both alone. Strict alignment is a refinement for later, not a starting point. pctis gone. It has been removed from the specification, and attag for test mode takes its place. Older guides that tell you to ramp up withpct=25are describing a tag that the current standard no longer defines, so plan your rollout by watching reports rather than by percentage.- Never publish two. When more than one DMARC record is found for a name, all of them are discarded, so a duplicate switches DMARC off entirely rather than doubling it.
The three traps in that one line
The name. The record belongs at _dmarc.yourdomain.com. Many panels append your domain to whatever you type in the name field, so entering the full name produces _dmarc.yourdomain.com.yourdomain.com, which answers nothing. After saving, look the record up from outside with the DNS checker and confirm the name you queried is the name that answers.
The reporting address. rua is not decoration. It is the mechanism that makes the rest of this work, and the aggregate reports arrive as XML attachments once a day from every large receiver. Send them to a dedicated mailbox, or to a free DMARC reporting service that turns them into a readable list of senders. An rua pointing at a mailbox nobody opens is the most common way this project dies quietly at step 3.
The subdomains. A subdomain inherits the organisational domain's policy unless it publishes its own, and sp= sets a different policy for existing subdomains. RFC 9989 adds np= for subdomains that do not exist at all, which is useful once you are enforcing: a strict np=reject shuts down spoofing from invented names like billing.yourdomain.com without touching the real ones.
Step 4: prove it with one test message per sender
Records published is not the same as mail authenticated. The proof is in a received message, so go and get one from every system on your step 0 list.
Send one message from each, to a Gmail address you can open. In Gmail, open the message, choose More next to Reply, and select Show original. Read the Authentication-Results header, which looks like this:
Authentication-Results: mx.google.com;
dkim=pass header.i=@yourdomain.com header.s=google;
spf=pass smtp.mailfrom=yourdomain.com;
dmarc=pass (p=NONE) header.from=yourdomain.comWhat you are checking is not just three passes. It is the domains next to them. header.i on the DKIM line and smtp.mailfrom on the SPF line both need to be your domain or a subdomain of it. A dkim=pass for somebody else's domain is the service authenticating itself, and DMARC will not count it for you.
Work down the list and mark each sender pass or fail. Where you see dmarc=fail, the mismatch between the From domain and the passing domains names the cause, and how to check a DMARC record covers the six causes in the order worth checking them.
Then leave it alone for a few weeks and read the reports. They will name senders your list missed. Every one of them has to either get domain authentication or get switched off before the next step.
Step 5: none, then quarantine, then reject
Move the policy only when the reports are boring. The test is simple: every sender in the last two weeks of reports either passes DMARC or is something you have deliberately decided to lose.
Then change p=none to p=quarantine, which asks receivers to treat failures as suspicious, usually meaning the spam folder. Wait another two weeks and read the reports again. Only then go to p=reject.
Why the patience is worth it. A policy applies to every message claiming to be from your domain, including the invoice reminders from a tool somebody set up in 2023 and nobody mentioned. At none that mail arrives and shows up in a report. At reject it is refused, and the first you hear of it is a customer saying they never got the invoice.
Google's sender guidelines set the floor you are clearing here. Every sender needs SPF or DKIM, valid forward and reverse DNS for the sending domain or IP, a TLS connection, messages formatted to RFC 5322, and a spam rate in Postmaster Tools below 0.3 percent. Senders of more than 5,000 messages a day to Gmail accounts need SPF and DKIM and DMARC, with the From domain aligned to either the SPF domain or the DKIM domain, plus one-click unsubscribe on marketing mail. A business sending a few hundred messages a day is under the bulk threshold, but the first list applies to everyone.
What this does not fix
Three records authenticate your mail. They do not make it welcome.
- Forwarding still breaks things. When a message is forwarded, SPF fails because the forwarder was not on your list. When a mailing list rewrites the subject or appends a footer, the DKIM signature no longer matches the body. There is a standard for preserving the original result through services that modify mail, Authenticated Received Chain, and Microsoft's guidance describes how a destination server can use it, but you do not control a stranger's forwarder. This is the other reason to rely on DKIM over SPF.
- Reputation is separate. An authenticated message with a complained-about link in it still goes to spam. Content, list hygiene and complaint rate are a different problem from authentication.
- Inbound spam is a different problem entirely. None of these records affect the junk arriving in your own inbox. They govern mail that claims to come from you.
A timeline you can hold a vendor to
If you are paying somebody to do this, here is roughly what the calendar looks like, so you can tell a slow job from a normal one.
- Day one, one to three hours. The sender list, the SPF record, the DKIM keys published at every provider, and the DMARC record at
p=none. All of it is panel work. - Day one to day three. DNS propagation plus the provider waits. Google asks for up to 48 hours before DKIM authentication starts working, which is the longest single wait in the project.
- Day three, one hour. Test messages from every sender, headers read, failures listed.
- Weeks one to four. Reports arriving, stragglers found, domain authentication set up in each tool that failed.
- Week four or five, ten minutes. Move to
p=quarantine. Two weeks later,p=reject.
Anyone who publishes p=reject on day one has skipped steps 3 and 4 and is gambling with your invoices.
Frequently asked questions
Do I need all three of SPF, DKIM and DMARC?
For a business domain, yes. SPF or DKIM alone satisfies Gmail's minimum for every sender, but only DMARC ties either result to the address your recipients actually see, and without an enforced DMARC policy anyone can send mail that appears to come from your domain.
Which order should I set them up in?
SPF, then DKIM, then DMARC at p=none. DMARC reads the other two, so publishing it first, especially at an enforcing policy, acts on failures you have not found yet.
Can I have two SPF records?
No. More than one record is a permanent error under RFC 7208, which makes SPF fail for every message. Merge them into one line. The same is true of DMARC, where multiple records are all discarded.
How long does it take to start working?
The records themselves can be read from outside within minutes of publishing, subject to the time to live on the old record. Provider-side activation is slower: Google says DKIM authentication can take up to 48 hours after the key is added.
What is a safe first DMARC record?
v=DMARC1; p=none; rua=mailto: followed by a mailbox you will actually read. It changes nothing about how your mail is handled and starts the reports that tell you what to fix.
Do I need DMARC if I send only a few emails a day?
You are below Gmail's 5,000 per day bulk threshold, so DMARC is not mandatory there. It is still worth publishing at p=none, because it costs nothing, it gives you the sender reports, and it is the only thing that stops someone else using your domain once you enforce it.
My SPF record has too many lookups. What do I remove?
Start with includes for services you no longer use, then replace includes for your own fixed servers with ip4: entries, which cost nothing against the limit. If you still cannot fit, move some senders onto a subdomain with its own SPF record.
Will this stop spam arriving in my inbox?
No. These records govern mail sent as your domain, not mail sent to you. Inbound filtering is a separate setting in your mailbox provider.
When three records are not the whole job
Most domains are an afternoon of panel work and a month of patience. The harder cases are the ones where the zone has a decade of accumulated records and nobody knows what half of them do, where mail is split across two providers mid-migration, or where an application sends transactional mail through code nobody has opened in years.
That is the kind of work our website fixes and maintenance service covers, and where it reaches into servers or cloud accounts, cloud and DevOps. If you would rather have it set up once and written down properly, tell us what you send and from where and we will come back with the records and the order to publish them in.
Tools mentioned in this post
- DMARC & SPF CheckerDMARC record lookup and SPF check in one: see which records your domain publishes, and how strictly they are enforced.
- DKIM CheckerVerify your DKIM public key is published correctly at its selector.
- DNS CheckerLook up A, AAAA, CNAME, MX, NS and TXT records for any domain in one shot.


