Skip to content
Cyber Security

How to Set Up SPF, DKIM and DMARC in Microsoft 365 and Google Workspace

Diagram cards for SPF, DKIM and DMARC email authentication records for Microsoft 365 and Google Workspace

Steps tested by the Invorx team. Last verified: 1 December 2026 against the Microsoft Learn and Google Workspace Admin Help pages listed under Sources.

Quick Answer
Publish one SPF record, turn on DKIM signing in your mail platform and add a DMARC record that starts at p=none. Set up SPF and DKIM first. Wait at least 48 hours, read the DMARC reports, then move DMARC to quarantine and reject in steps.

Most domains fail at the same point: the three records exist, but nobody checked that every service that sends mail for the domain is covered. Then DMARC is tightened and invoices, newsletters or helpdesk replies land in spam. This guide gives the order that avoids that, with exact steps for Microsoft 365 and Google Workspace.

What Do SPF, DKIM and DMARC Each Do?

Record What it proves Where it lives
SPF Which servers may send mail for your domain One TXT record on the domain
DKIM The message was signed by your domain and not changed on the way Public key in DNS, one or two selector records
DMARC What the receiver does when SPF and DKIM do not line up with the From address TXT record on _dmarc

DMARC passes only when SPF or DKIM passes and the domain in that check matches the visible From domain. That match is called alignment. It is the reason DMARC can fail while SPF and DKIM both show pass: the passing check used a different domain, often the domain of a third party sender.

What Should You Check Before You Add Any Record?

  • List every sender. Mail platform, website forms, CRM, newsletter tool, helpdesk, invoicing tool and any printer or scanner that emails.
  • Find your current records. Look up the TXT records of the domain. If an SPF record already exists, edit it. Do not add a second one.
  • Get DNS access. You need rights to add TXT and CNAME records at your DNS host.
  • Create a mailbox for reports. A shared mailbox or a group works. DMARC reports arrive here as XML attachments.

Which Path Fits Your Setup?

If you have Do this
Only Microsoft 365 sends mail Use the Microsoft 365 SPF record, enable DKIM in the Defender portal, then DMARC at p=none
Only Google Workspace sends mail Use the Google SPF include, generate the DKIM key in the Admin console, then DMARC at p=none
Your platform plus a newsletter or CRM tool Add that tool to the same SPF record and set up its own DKIM. Do not publish a second SPF record
More than 5,000 messages a day to Outlook.com addresses You need all three records. Microsoft states a DMARC policy of at least p=none that aligns with SPF or DKIM
A domain that never sends mail Publish SPF with no senders (v=spf1 -all) and a DMARC record at p=reject. This is common practice and not taken from the vendor pages above

How Do You Set Up SPF, DKIM and DMARC in Microsoft 365?

Step 1: SPF

According to Microsoft Learn, the SPF record for a domain that sends only through Exchange Online is:

v=spf1 include:spf.protection.outlook.com -all

Microsoft recommends -all (hard fail) for Microsoft 365 domains. It also states that only one SPF record is allowed per domain and that several records cause a permanent error. GCC High, DoD and 21Vianet tenants use different include values, so check the Microsoft page for your cloud.

Step 2: DKIM

  1. Open the Defender portal and go to Email & collaboration > Policies & rules > Threat policies > Email authentication settings. The direct address is security.microsoft.com/authentication.
  2. Select the DKIM tab and choose your domain.
  3. Switch the toggle to Enabled. The status changes to CnameMissing and a flyout shows two CNAME records.
  4. Create selector1._domainkey and selector2._domainkey as CNAME records at your DNS host. Copy the values from the portal.
  5. Go back to the flyout and select Sign messages for this domain with DKIM signatures. The status should show that the domain is signing.
Heads up: Microsoft’s DKIM guide says it introduced a new DKIM record format for new custom domains in May 2025. The target now ends in dkim.mail.microsoft. Older domains keep the onmicrosoft.com format, and the two formats cannot be mixed for the same selector. Always copy the values from the portal and never from a blog post, this one included. Microsoft also says Microsoft 365 signs mail from the initial *.onmicrosoft.com domain by default, but not from your custom domain until you enable it.

Step 3: DMARC

Create a TXT record with the host _dmarc:

v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com

Microsoft’s DMARC guide notes that a DMARC record covers every subdomain that has no record of its own, but each subdomain still needs its own SPF and DKIM to pass.

How Do You Set Up SPF, DKIM and DMARC in Google Workspace?

  1. SPF. Publish a TXT record that includes Google. Google’s SPF page gives the value for Workspace-only sending as v=spf1 include:_spf.google.com ~all. If you already have an SPF record, add the include to it.
  2. DKIM. In the Admin console (see Google’s DKIM guide) open Menu > Apps > Google Workspace > Gmail > Authenticate email. Select the domain and click Generate New Record. The default selector is google. Choose a 2048-bit key if your DNS host supports it, otherwise 1024.
  3. Add the TXT record at your DNS host, then click Start authentication. Google says it can take up to 48 hours before DKIM starts working.
  4. DMARC. Publish the same _dmarc TXT record as above with p=none.

How Fast Should You Move DMARC to Quarantine and Reject?

Microsoft and Google both say to go in steps, but their examples differ, so choose by the size of your mail volume.

Microsoft Learn Google Workspace Admin Help
Start p=none, monitor the reports p=none for about one week, reports reviewed daily
Next p=quarantine with pct raised through 10, 25, 50, 75, 100 Quarantine at about 10% for a small organization or about 1% for a large one
End p=reject, optionally ramped the same way Raise the percentage until it covers all messages. Reject is riskier because failing mail is never delivered
Prerequisite Cover your mail traffic first Set up DKIM and SPF at least 48 hours before DMARC

A practical reading of both: stay at p=none until the reports show no legitimate sender failing, which can be longer than one week if you send monthly invoices or quarterly mailings. This is a judgment from the two vendor pages and not a vendor rule.

v=DMARC1; p=quarantine; pct=10; rua=mailto:dmarc-reports@yourdomain.com

What If Several Services Send Mail for Your Domain?

Take a domain on Microsoft 365 that also sends a monthly newsletter through a marketing tool. The newsletter tool needs two things: its include in the one SPF record, and its own DKIM keys signed with your domain. Without the DKIM part, the newsletter passes SPF only for the tool’s own bounce domain, which does not align with your From address. Under p=quarantine that newsletter goes to spam.

The merged SPF record then looks like this, with the second include taken from the tool’s own setup page:

v=spf1 include:spf.protection.outlook.com include:spf.newsletter-tool.example -all

Microsoft warns that SPF fails with a permanent error when a check needs more than 10 DNS lookups, and that fewer than 10 include: statements does not guarantee fewer than 10 lookups. If you keep adding tools, test the count.

How Do You Check That It Works?

  1. Send a test message from the domain to a Gmail address. Open the message, choose Show original and look for SPF, DKIM and DMARC all showing PASS.
  2. Confirm the DKIM signing domain matches your From domain.
  3. After 24 to 48 hours open the report mailbox. Each XML file lists sending IPs and pass or fail counts. Any sender you do not recognize is either a forgotten service or a spoofer.
  4. Repeat the test for each service that sends mail, not only for your mailboxes.

What Goes Wrong Most Often?

Problem How to confirm Fix
Two SPF records Two TXT records start with v=spf1 Merge them into one record
More than 10 DNS lookups An SPF checker reports a permanent error Remove unused includes or move senders to a subdomain
DKIM not enabled for the custom domain Message headers show no signature from your domain Enable signing in the Defender portal or start authentication in the Admin console
DMARC fails while SPF and DKIM pass The passing domain differs from the From domain Set up DKIM for the third party sender with your domain
Forwarded mail fails Failures come from forwarding servers in the reports Rely on DKIM, which survives forwarding better than SPF

Do Small Senders Need All Three Records?

Yes, for two reasons. Microsoft states that senders of more than 5,000 emails a day to Outlook.com addresses must have SPF, DKIM and DMARC, with enforcement from 5 May 2025. Google states that its sender guidelines apply to anyone sending to personal Gmail accounts and that Gmail raised enforcement on non-compliant traffic from November 2025. A small sender is below the Microsoft threshold, but the records still stop others from spoofing your domain.

Frequently Asked Questions

Do I need SPF and DKIM before DMARC?

Yes. DMARC reads the results of SPF and DKIM. Google advises setting up both at least 48 hours before DMARC.

How long does DMARC take to implement?

Publishing the record takes minutes. Reaching p=reject safely takes weeks, because you must watch the reports until every real sender passes.

What DMARC record should I start with?

Start with v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com. It changes no mail delivery and starts the reports.

Why does DMARC fail when SPF and DKIM pass?

Because the domains do not align. The passing SPF or DKIM result belongs to another domain, usually a third party sender, and not to the domain in the From address.

Conclusion

Set up SPF and DKIM first, publish DMARC at p=none, then tighten it only when the reports show every real sender passing. Keep one SPF record, copy DKIM values from your own portal and test each sending service. Next reads: protect Office 365 from phishing attacks and Exchange Server not receiving external email.

Sources

  • Microsoft Learn: Set up SPF, Use DKIM, Use DMARC (pages dated July 2026)
  • Google Workspace Admin Help: Set up SPF, Set up DKIM, Recommended DMARC rollout, Email sender guidelines FAQ
  • Microsoft Defender for Office 365 blog, 2 April 2025: Outlook’s new requirements for high-volume senders