Microsoft 365 / Exchange Online SPF, DKIM & DMARC Guide

Authenticate Microsoft 365 / Exchange Online custom domains with exact SPF, dual-CNAME DKIM selectors, and DMARC records.

SPF: 2 Lookupsselector1 & selector2 CNAMEExchange Online

Copy-Ready DNS Records & Configuration

Host / NameTypeValueTTLPurpose
@ TXT v=spf1 include:spf.protection.outlook.com -all 3600 Microsoft 365 SPF (2 estimated DNS lookups)
selector1._domainkey CNAME selector1-yourdomain-com._domainkey.tenant.r-v1.dkim.mail.microsoft 3600 Primary M365 DKIM CNAME (copy exact target from Defender portal)
selector2._domainkey CNAME selector2-yourdomain-com._domainkey.tenant.r-v1.dkim.mail.microsoft 3600 Secondary M365 DKIM CNAME for key rotation
_dmarc TXT v=DMARC1; p=quarantine; pct=100; rua=mailto:dmarc@yourdomain.com; 3600 DMARC policy record

Interactive SPF 10-DNS-Lookup Limit Checker

MechanismTypeDirectEst. TotalNotes

Step-by-Step Deployment Checklist

  1. Open Microsoft Defender Portal -> Policies & rules -> Threat policies -> Email authentication settings -> DKIM.
  2. Click your custom domain -> 'Create DKIM keys' to retrieve the exact `selector1._domainkey` and `selector2._domainkey` CNAME targets.
  3. Publish both CNAME records in your DNS host (unproxied) and then toggle 'Sign messages for this domain with DKIM signatures' to Enabled.
  4. Publish `v=spf1 include:spf.protection.outlook.com -all` (or merge with existing senders) and add `_dmarc`.

Common Pitfalls to Avoid

JetBrains Plugin + Gumroad

Never Commit SMTP Passwords, DKIM Private Keys, or API Secrets to Git

EnvGuard for JetBrains IDEs scans .env, YAML, and DNS config files locally before commit — paired with our DevOps & AI Automation Kits on Gumroad.

Frequently Asked Questions

How many DNS lookups does spf.protection.outlook.com use?

`spf.protection.outlook.com` typically uses 2 DNS lookups (1 direct plus 1 nested include for `spfa.protection.outlook.com`).

Why are there two DKIM selectors in Microsoft 365?

Microsoft uses `selector1` and `selector2` so you can rotate DKIM keys in the Defender portal with zero downtime.

Can I use Google Workspace and Microsoft 365 on the same SPF record?

Yes: `v=spf1 include:_spf.google.com include:spf.protection.outlook.com ~all` uses ~6 of your 10 DNS lookups, leaving 4 lookups of headroom.

Related DNS & Email Auth Guides