How to Set Up SPF, DKIM and DMARC for Microsoft 365

If your business email runs on Microsoft 365 (Outlook with your own domain), three DNS records decide whether your email reaches the inbox or the spam folder: SPF, DKIM and DMARC. This guide walks you through all three, in order, with the exact values to copy.

Time needed: about 20 minutes of work, plus waiting time for DNS changes (usually under an hour, occasionally up to 48 hours).

Before you start, you’ll need two logins:

  • A Microsoft 365 admin account that can open the Microsoft Defender portal (security.microsoft.com). A Global Administrator or Security Administrator works.
  • The company that manages your domain’s DNS. This is often where you bought the domain (GoDaddy, Squarespace, Namecheap) or a service like Cloudflare. Not sure? Our free check shows your current records.

Why this matters now

Since May 2025, Outlook.com, Hotmail and Live.com reject email from high-volume senders that don’t pass SPF, DKIM and DMARC, joining Gmail and Yahoo. Smaller senders aren’t rejected outright, but they’re judged more harshly without these records, and that’s often why invoices, quotes and replies land in spam.

There’s also a Microsoft-specific catch: out of the box, Microsoft 365 signs your email with its own onmicrosoft.com domain, not yours. That signature doesn’t count toward DMARC for your business domain, so until you finish Step 2, your email is missing half its proof.

RecordWhat it doesYou set it up in
SPFLists the servers allowed to send email for your domainYour DNS host
DKIMAdds a digital signature proving your email wasn’t forged or changedYour DNS host, then the Microsoft Defender portal
DMARCTells receivers what to do with email that fails SPF and DKIM, which stops others from spoofing youYour DNS host

Step 1: Add your SPF record

First, look at your existing DNS records for a TXT record that starts with v=spf1. A domain can only have one SPF record. If one already exists, edit it instead of adding a second, because two SPF records cancel each other out.

If you only send email through Microsoft 365, add this TXT record:

TypeTXT
Host / Name@ (some hosts want your domain name, like yourcompany.com)
Valuev=spf1 include:spf.protection.outlook.com -all

Microsoft recommends ending with -all (a hard fail), which lets DMARC act on forged email even when it carries no signature. If you’re still tracking down every service that sends as you, ~all is the gentler choice while you work, but plan to switch.

Do other services send email as your domain? Newsletters, CRMs, invoicing and help desk tools often do. Add each one’s include: to the same record, before -all. For example, Microsoft 365 plus Google Workspace:

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

Each service tells you its include value in its own setup instructions. Keep the total under 10 DNS lookups; past that, SPF fails for every email. The free check counts them for you.

Step 2: Turn on DKIM signing

Microsoft 365 uses two DNS records for DKIM, called selector1 and selector2, so it can swap keys without interrupting your email. Unlike Google, these are CNAME records that point to Microsoft, not long TXT values.

Get your two records from Microsoft

  1. Sign in to the Microsoft Defender portal at security.microsoft.com.
  2. Go to Email & collaboration → Policies & rules → Threat policies → Email authentication settings, then open the DKIM tab.
  3. Click your domain’s row (not the toggle) to open its details panel.
  4. Find the Publish CNAMEs section and click Copy. Keep this panel open. (If you don’t see the CNAMEs yet, slide the domain’s toggle to Enabled; Microsoft shows them in a “Client error” message, which is normal at this stage. Click OK.)

Publish them in DNS

At your DNS host, add two CNAME records:

TypeHost / NamePoints to
CNAMEselector1._domainkeyThe selector1 value Microsoft gave you
CNAMEselector2._domainkeyThe selector2 value Microsoft gave you

The values look something like one of these, depending on when your domain was added to Microsoft 365:

  • Newer domains: selector1-yourcompany-com._domainkey.yourcompany.n-v1.dkim.mail.microsoft
  • Older domains: selector1-yourcompany-com._domainkey.yourcompany.onmicrosoft.com

Copy the values from your own portal, never from an example. Microsoft changed the format for new domains in 2025, and part of the newer value is assigned to your account, so a value typed from a guide (including this one) won’t work.

Two more common mistakes: Enter only selector1._domainkey as the host; most DNS hosts add your domain automatically, so typing selector1._domainkey.yourcompany.com creates a broken record. And if you use Cloudflare, set both records to DNS only (grey cloud), not proxied.

Start signing

Back in the Defender portal, in your domain’s details panel, turn on Sign messages for this domain with DKIM signatures. If the status says CnameMissing, Microsoft hasn’t seen your new records yet; wait an hour and try again (it can take up to 48 hours). When it works, the status reads Signing DKIM signatures for this domain.

For IT folks: Microsoft 365 creates 1024-bit keys by default. To move to 2048-bit, run Rotate-DkimSigningConfig -Identity yourcompany.com -KeySize 2048 in Exchange Online PowerShell. The new key takes about four days to take over, and nothing changes in DNS.

Step 3: Add DMARC, then tighten it

Once SPF and DKIM are both working, add DMARC in monitor-only mode, so nothing gets blocked while you confirm everything passes:

TypeTXT
Host / Name_dmarc
Valuev=DMARC1; p=none; rua=mailto:[email protected]

Replace [email protected] with a mailbox you’ll check. Mail providers send daily reports there showing every server that sent email using your name. A shared mailbox or a Microsoft 365 group keeps them out of your main inbox.

Monitor mode alone doesn’t stop spoofing. Microsoft recommends going slowly and fixing anything the reports turn up. Once your real email passes for at least a week, tighten the policy in steps:

StageDMARC valueWhat happens
1. Monitor (1+ week)v=DMARC1; p=none; rua=mailto:[email protected]Nothing is blocked; you collect reports
2. Quarantine a sharev=DMARC1; p=quarantine; pct=10; rua=mailto:[email protected]10% of failing email goes to spam; raise pct to 25, 50, then 100 over a few weeks
3. Rejectv=DMARC1; p=reject; rua=mailto:[email protected]Forged email using your domain is refused

Bonus: protect your onmicrosoft.com address too. Every Microsoft 365 account also has a yourcompany.onmicrosoft.com domain that scammers can try to imitate. In the Microsoft 365 admin center, go to Settings → Domains, select your onmicrosoft.com domain, open DNS records, and add a TXT record named _dmarc with the value v=DMARC1; p=reject.

Step 4: Check that it worked

  1. Run your domain through the free MailWatchman check. SPF, DKIM and DMARC should all show as passed (DMARC shows “needs attention” while it’s at p=none, which is expected at first).
  2. Send an email from your Microsoft 365 account to a personal Gmail address. Open it, click the three dots, and choose Show original. You should see PASS next to SPF, DKIM and DMARC, and the DKIM line should mention your own domain, not onmicrosoft.com.

Common problems and fixes

ProblemFix
DKIM status stuck on CnameMissingCheck both hosts are exactly selector1._domainkey and selector2._domainkey, the values were copied from your portal, Cloudflare records are DNS only, and wait up to 48 hours.
DKIM passes, but for onmicrosoft.comSigning for your own domain isn’t on yet. Finish “Start signing” above.
Two SPF recordsMerge every include: into one record and delete the other.
SPF over 10 lookupsRemove includes for tools you no longer use.
Newsletter or invoices still go to spamThat tool sends on its own servers. Add its SPF include, and turn on DKIM in that tool too.
DMARC stuck at p=noneIt protects nothing at this setting. Move through the stages above once reports are clean.

These records can break without warning

A website change, a new email tool or a DNS update can quietly undo this work. MailWatchman checks your domain every day and emails you the moment something changes, with the fix. Plans start at $6 a month.

Based on Microsoft’s own instructions for SPF, DKIM and DMARC. Microsoft occasionally renames menus; if a step looks different, the record values above stay the same. Bought Microsoft 365 through GoDaddy? See our GoDaddy guide for the GoDaddy-specific steps. Using a different provider? See all our email setup guides. Curious how common this is? See our Santa Clara County email spoofing study.