How to Set Up Email Security for Your Business Domain (SPF, DKIM, DMARC)
Last updated: November 11, 2026 · Steps checked against Google Workspace Help and Microsoft Learn (sources at the bottom)
We may earn a commission if you buy through links here — it never changes our picks.
If your business sends email from its own domain, anyone else can send email claiming to be from that domain too. No password is guessed and no account is broken into. The forger just writes your domain in the From line, and receiving systems cannot tell the difference unless you publish the three standard checks that let them: SPF, DKIM, and DMARC. This guide sets them up in the only safe order: SPF, then DKIM, then DMARC in monitoring mode, then enforcement. The steps work for Google Workspace and Microsoft 365 alike, because the records live in your domain's DNS settings either way. You need administrator access to your email service and your DNS host, and nothing here costs money.
Why anyone can send email as your business
The flaw is in the original design. Internet email runs on SMTP, and Microsoft's documentation states the problem plainly: SMTP makes no effort to validate that a sender is who they claim to be. A message also carries two sender addresses: the envelope sender, which routes the message between servers, and the From address shown in the reader's mail app. The two do not have to match, and nothing checks either against the truth.
Sending mail with a forged sender is called spoofing, and Microsoft lists spoofed senders as a standard ingredient in business email compromise and phishing. The classic version needs no link and no attachment: a message appearing to come from the owner, or a regular supplier, asks whoever pays the bills to update bank details or settle an invoice a new way. Habits such as the verify-by-phone rule in our guide to spotting a phishing email catch many of these at the desk. These records work one level down, at the receiving server. One limit: they protect your exact domain, not a lookalike with a swapped letter.
The three records in plain words
Each record answers a different question, and DMARC only works because the other two answer theirs first.
| Record | What it does | Where it lives |
|---|---|---|
| SPF | Lists the servers and services allowed to send mail for your domain. | One TXT record on your domain itself, host @ |
| DKIM | Signs each outgoing message with a private key. The receiver verifies the signature against the matching public key in DNS, proving your domain signed it and it was not altered on the way. | A public key record in DNS, plus signing on in your email service |
| DMARC | Tells receivers what to do with mail that fails the other checks, and where to send you reports. | One TXT record at the host _dmarc |
The word that ties them together is alignment. Passing SPF or DKIM alone is not enough: the domain that passed must match the From address your reader sees. A message passes DMARC when at least one check passes and aligns, and fails when both fail or pass for the wrong domain. Alignment is relaxed by default, so a subdomain can match. Leave the default in place.
Do them in this order, and only this order
- 1. SPF. Publish your one sender list.
- 2. DKIM. Turn on signing, so messages carry proof that survives forwarding.
- 3. DMARC at p=none. Monitoring mode. Nothing is blocked, and reports start arriving.
- 4. Reports, then enforcement. Fix the senders the reports expose, then quarantine, then reject.
Google is explicit: SPF and DKIM first, authenticating for at least 48 hours before DMARC. A strict policy published earlier tells the world to reject your own mail.
Before you start: list every sender
Your SPF record must name every service that sends mail using your domain, and a forgotten sender fails later, on the day you tighten DMARC, when a real invoice gets rejected. So inventory first, while nothing can break. Write down: your email platform. Your website, including contact forms, order confirmations, and password resets. Invoicing and accounting tools. Your help desk, if it replies as your domain. Newsletters. Appointment, delivery, payroll, and HR tools. Keep each service's own instructions open: each publishes the exact SPF entry and DKIM steps it needs.
Confirm you can sign in to your email console and your DNS host, often your registrar. And create the mailbox or group that will receive DMARC reports, not your personal inbox. Both vendors recommend a dedicated address for these daily reports. dmarc-reports at your own domain is the usual shape.
Step 1: Publish your SPF record
SPF, short for Sender Policy Framework, is the sender list: one line of text, published as a TXT record on your domain. Receivers check whether the sending server is listed in it.
Check what already exists
At your DNS host, look for a TXT record starting with v=spf1. One domain gets exactly one SPF record. If one exists, edit it in the next step, never add a second. Microsoft documents why: two SPF records produce a permanent error, a permerror, and the check fails for everyone.
Build your one record from your sender list
Every SPF record starts with v=spf1, lists each approved sender with include: in front of it, and ends with a rule for everyone else. Google Workspace only: v=spf1 include:_spf.google.com ~all. Microsoft 365 only: v=spf1 include:spf.protection.outlook.com -all. Extra senders join the same line: Google plus Mailchimp is v=spf1 include:_spf.google.com include:servers.mcsv.net ~all, from Google's own table. Use the exact include each service publishes. The ending matters. ~all is a soft fail: unlisted mail is accepted but marked. -all is a hard fail: unlisted mail should be rejected. Google recommends ~all, Microsoft -all. Follow your own platform.
Add the record at your DNS host
Open the TXT records page at your DNS host. Create a TXT record with host @, meaning the domain itself, and your line as the value, or replace the existing record's value with your combined line. Google advises SPF can take up to 48 hours to start working.
Keep the record under the lookup limit
SPF has a hard ceiling. Each include can trigger further lookups, and past 10 DNS lookups the check fails with a permerror. A record built from your real inventory stays clear of this. When you stop using a service, remove its include, as Google's guidance also advises.
You should now have: exactly one TXT record starting with v=spf1, naming every current sender. Warning: SPF does not pass down to subdomains, so any subdomain you send from needs its own record. DMARC differs, as step 3 shows.
Step 2: Turn on DKIM signing
DKIM, short for DomainKeys Identified Mail, is the signature. Your sending service holds a private key and signs important parts of each message, including the From address. The matching public key sits in your DNS, and a receiver uses it to verify the signature. DKIM also covers SPF's weakness: forwarding changes the sending server, so forwarded mail often fails SPF, while the signature travels with the message and can still pass. The pattern is the same on both platforms: reveal the key, publish it in DNS, switch signing on, verify. Google uses a TXT record. Microsoft 365 uses two CNAME records.
Google Workspace track
Generate the key in the Admin console
In the Google Admin console, go to Apps, then Google Workspace, then Gmail, and click Authenticate email. Select your domain, click Generate New Record, choose 2048 bit length if your DNS host supports it (longer keys are more secure), keep the default selector google, and click Generate. Copy the TXT value shown. Do not click Start Authentication yet. Note: on a new domain, Google requires a wait of 24 to 72 hours after Gmail is turned on before a key can be generated.
Publish the public key in DNS
At your DNS host, add a TXT record with host google._domainkey and the value you copied, beginning v=DKIM1; k=rsa; p= followed by your key. Copy it exactly: the key is unique to your domain, so no printed key can work for you. Google says DKIM can take up to 48 hours to start working.
Start authentication and verify it
Return to Authenticate email and click Start authentication. Working setup shows the status Authenticating email with DKIM. Prove it from the receiving end: send a message to someone on Gmail, open it, choose Show original next to Reply, and find Authentication-Results, which should report DKIM=pass. Google warns you cannot verify this by sending a test message to yourself.
Microsoft 365 track
Open the DKIM settings in the Defender portal
Microsoft states that no DKIM signing happens for a custom domain until you set it up. In the Defender portal, go to Email and collaboration, then Policies and rules, then Threat policies, then Email authentication settings, and open the DKIM tab. Select your domain.
Publish the two CNAME records the portal shows you
Microsoft generates two key pairs per domain, published through CNAME records at selector1._domainkey and selector2._domainkey. Only one selector is active at a time. The second exists for key rotation. Copy the exact target the portal displays for each record into DNS, exactly as shown. They are specific to your account, and Microsoft is blunt that its article examples are for illustration only. Never type a target copied from a tutorial.
Turn signing on, verify, then repeat for every sender
In the portal, turn on DKIM signing once the CNAME records are in place. Verify as in the Google track: a received message's header should show a DKIM pass in Authentication-Results, with the signing domain, the d= value, matching your own. That match is what DMARC alignment checks next. Then repeat for every other sender on your inventory. Google's DMARC guide makes this a formal step: contact each third-party provider and make sure SPF and DKIM are set up for mail it sends as you. A service that cannot sign with your domain is a finding, not a detail. Consider giving it a subdomain, as both vendors suggest for senders you do not control.
You should now have: DKIM signing on and verified for your main platform, and an answer for every other sender on your inventory.
Step 3: Add DMARC in monitoring mode
DMARC, short for Domain-based Message Authentication, Reporting, and Conformance, is the policy layer. It reads the SPF and DKIM results, applies the alignment rule, and follows your instructions for mail that fails. It also turns on reporting, how you discover the sender you forgot before any blocking begins.
Wait until SPF and DKIM are really working
Google's instruction is to let SPF and DKIM authenticate for at least 48 hours before turning on DMARC, and to expect delivery problems if DMARC arrives first. Re-run the header check from step 2 until a real message shows both passes.
Write your starter record
Your first record is deliberately gentle: v=DMARC1; p=none; rua=mailto:[email protected], with your own domain and mailbox in place of the examples.
| Tag | Meaning |
|---|---|
| v=DMARC1 | Identifies the record as DMARC. It must come first. |
| p=none | The policy for failing mail. None: deliver normally, but log it in a report. Quarantine: send it to spam. Reject: refuse it. You start at none on purpose. |
| rua=mailto:... | Where aggregate reports go. The address must start with mailto:. Reports are daily summaries from systems that received mail claiming your domain. |
| pct= (optional) | Percentage of failing mail the policy applies to. Defaults to 100. It matters when you tighten in stages. |
Leave the alignment tags, adkim and aspf, out. Out means relaxed alignment, the default at this stage.
Publish the record at _dmarc
At your DNS host, add a TXT record with host _dmarc and your starter record as the value. As with SPF, there is nothing to set in the email console for a custom domain. After saving, re-open the record and check the host, because some DNS hosts append your domain automatically and can double it. With more than one domain, repeat the guide per domain.
You should now have: one TXT record at _dmarc holding your p=none record, with first reports reaching your mailbox within a day or so. Subdomains behave better here than under SPF: one DMARC record covers every subdomain without its own record, including ones that do not exist.
Read the reports, then tighten the policy
Publishing p=none is the midpoint, not the end. Aggregate reports are machine-readable XML files, and reading them raw is miserable. What matters is what Microsoft says one contains: the servers sending mail that uses your domain, whether they pass or fail, and what action was taken. Read them in the reports mailbox, or through a reporting service if volume justifies it. Every source should be one you recognize, passing with alignment.
Expect the first reports to teach you something: a forgotten tool, a form sending unsigned, a service signing with its own domain, which passes DKIM yet fails DMARC because alignment is about your domain. Fix each as steps 1 and 2 did, or move it to a subdomain. Microsoft's rollout starts with a low-volume domain and saves the main domain for last. When legitimate mail passes consistently, tighten in two monitored moves. First p=quarantine, which files failing mail as spam. Soften it with the pct tag, applying it to a rising share of failing mail, 10, then 25, 50, 75, and 100, Microsoft's ladder. Then p=reject, where forged mail is refused rather than filed. Google's rollout is the same arc. There is no shortcut: records take an hour, confidence takes weeks of clean reports, and that gap keeps real invoices flowing.
Own a domain you never send from? Lock it today
Spare domains skip the slow rollout, because there is no legitimate mail to protect. Microsoft's settings for a domain that should never send mail are SPF v=spf1 -all and DMARC v=DMARC1; p=reject;. Apply the pair to defensive registrations and, if you never send from it, to your onmicrosoft.com domain as well.
How to check it worked
| Check | How | What pass looks like |
|---|---|---|
| One SPF record | Review TXT records at the DNS host | Exactly one record starts with v=spf1 and lists only current senders |
| SPF and DKIM pass | Send to an outside mailbox, view the full header | Authentication-Results shows an SPF pass and a DKIM pass for your domain |
| DMARC published, passing | Check the TXT record at _dmarc, and the same header | One record starting v=DMARC1, and a DMARC pass in the header |
| Reports flow | Open the reports mailbox | Daily aggregate reports arriving, and every source is one you recognize |
Common mistakes that break real mail
- A second SPF record. Two records starting with v=spf1 produce a permerror and the check fails outright. One record, edited, always.
- Jumping straight to p=reject. Enforcement before reports is how a business blocks its own invoicing tool.
- Forgetting a third-party sender until quarantine. The inventory and the p=none reports are your two chances to catch it.
- Copying key or CNAME values from a guide. Keys are generated per domain, and Microsoft 365 CNAME targets are specific to your account. Printed values never work.
- Passing the 10-lookup limit. Every include can add lookups, and dead senders count toward the total.
- Assuming subdomains inherit SPF. They do not. A sending subdomain needs its own SPF and DKIM. DMARC is the one that inherits.
- Letting a service rewrite your mail. Services that modify messages in transit can break DKIM and therefore DMARC, a risk both Microsoft and Google flag.
Common questions
Does this stop phishing emails from reaching my own inbox?
No. These records govern mail sent from your domain to everyone else. Inbound mail is judged by the sender's records, your provider's filters, and your team's habits, covered in our phishing walkthrough and step 6 of the 7-step security checklist.
Do I really need all three?
Yes. Microsoft calls the three interdependent building blocks and says anything less is substandard protection. SPF can be passed by the wrong domain, and DKIM does not require the signing domain to match the From domain. DMARC closes both gaps with alignment and policy. Volume senders have no choice anyway: Google states that bulk senders are required to set up all three.
What about the email my website sends?
It counts as a sender, full stop. Form notifications, receipts, and account emails leave using your domain, so give that service its SPF include and DKIM setup too. Website mail is the sender owners forget most, because nobody thinks of a form as an email account.
The setup, as a checklist
- Every sender inventoried, including the website and every tool that mails as you.
- One SPF record, built from that inventory, under the 10-lookup limit.
- DKIM signing on and verified for the main platform and each other sender.
- A dedicated reports mailbox, then DMARC published at p=none at the _dmarc host.
- Reports read until every legitimate source passes, aligned.
- Policy tightened to quarantine, then reject, with a check after each move.
- Spare domains locked immediately with v=spf1 -all and p=reject.
Done in this order, your domain stops being an easy address to fake.
Where these steps come from
Every record format, console path, and rollout step here was checked against the official sources below in November 2026.
- Google Workspace Help: Set up SPF
- Google Workspace Help: Set up DKIM
- Google Workspace Help: Set up DMARC
- Microsoft Learn: How email authentication works in Microsoft 365
- Microsoft Learn: Set up SPF for your Microsoft 365 domain
- Microsoft Learn: Use DKIM to validate outbound email in Microsoft 365
- Microsoft Learn: Use DMARC to validate email in Microsoft 365