Microsoft 365 SPF, DKIM and DMARC: DNS records, the Defender portal and testing
Published 7 October 20268 min readBy the SmoothSeen editorial team
To authenticate Microsoft 365 email on your own domain, publish three things in DNS: an SPF TXT record with v=spf1 include:spf.protection.outlook.com -all, two DKIM CNAMEs (selector1._domainkey and selector2._domainkey) using the values the Defender portal gives you, and a DMARC TXT record at _dmarc, starting with p=none. Then switch DKIM signing on.
Key points
- SPF for a custom domain in Microsoft 365 is v=spf1 include:spf.protection.outlook.com -all. Microsoft recommends -all and a single SPF record per domain or subdomain.
- Microsoft 365 does not DKIM-sign mail from your custom domains until you publish two CNAMEs (selector1 and selector2) and enable signing in the Defender portal or with PowerShell.
- Since May 2025, newly added domains use a different target format for those CNAMEs, ending in dkim.mail.microsoft. The portal gives you the exact value.
- Since 5 May 2025, Outlook.com requires SPF, DKIM and DMARC (at least p=none) from anyone sending it more than 5,000 messages a day, and rejects non-compliant mail with error 550 5.7.515.
To check it on your own site: SEO audit
On this page
- What does Microsoft 365 do for you, and what do you have to do?
- Step 1: the SPF record
- Step 2: DKIM with the two CNAMEs
- Step 3: DMARC in phases
- The example records for example.com
- What does Outlook.com require from high-volume senders?
- How to check it
- What SmoothSeen does with this
- What to do this week
- Frequently asked questions
One line on each. SPF is the list of servers allowed to send with your domain. DKIM is a signature on every message that the recipient checks against a public key published in your DNS. DMARC says what to do with mail that passes neither SPF nor DKIM in alignment with the visible sender, and where to send reports. This guide applies all three to Microsoft 365, using Microsoft Learn documentation updated on 3 July 2026; if you use Google, the equivalent guide is Google Workspace SPF, DKIM and DMARC.
What does Microsoft 365 do for you, and what do you have to do?
- Domain
yourcompany.onmicrosoft.com(the initial domain)- SPF
- Already set up by Microsoft
- DKIM
- Already signing by default
- DMARC
- You create it, in the admin centre
- Domain
- Your custom domain (
example.com) - SPF
- You create it in DNS (adding the domain already asks for it)
- DKIM
- Not signing until you configure it
- DMARC
- You create it in DNS
- Domain
- Parked domains that send no email
- SPF
v=spf1 -all- DKIM
- Do not publish DKIM
- DMARC
v=DMARC1; p=reject;
That is how Microsoft sums it up across its three guides123. One detail matters: Microsoft 365 has no portal or cmdlet for managing SPF; you write it in your domain's DNS, at your registrar or DNS host1.
Step 1: the SPF record
If Microsoft 365 is your only source of email, the TXT record at the root of the domain is1:
v=spf1 include:spf.protection.outlook.com -allWhat Microsoft says about each part:
-allrather than~all. Microsoft recommends the hard fail (-all) because it also recommends DKIM and DMARC. It explains that DMARC treats both as an SPF failure, but with~allthe DMARC policy has practically no effect on messages that fail SPF and carry no DKIM signature1. Google, by contrast, recommends~allfor Google Workspace.- One SPF record per domain or subdomain. Two records make SPF return
permerror1. If another service also sends for you, add itsinclude:to the same record. - Fewer than 10 DNS lookups.
include:,a,mx,existsandredirectcount;ip4:,ip6:andalldo not. Nestedinclude:statements add their own lookups, so fewer than teninclude:statements does not guarantee fewer than ten lookups1. - Do not "flatten" Microsoft's include (replace it with IP addresses): its sending infrastructure uses addresses that change often1.
- A TTL of at least 3600 seconds, to avoid DNS lookup timeouts1.
Every subdomain that sends email needs its own SPF record. For services you do not control, such as a newsletter platform, Microsoft recommends a subdomain (marketing.example.com) so their problems do not hurt the main domain's reputation1.
Step 2: DKIM with the two CNAMEs
Microsoft 365 generates two key pairs per domain and publishes the public keys in its own zone. You only create two CNAME records pointing at them; one is active and the other waits for the next rotation2.
The CNAME format changed in May 2025
Custom domains added since May 2025 use a new target format2:
selector1._domainkey → selector1-<domain-with-dashes>._domainkey.<initial-prefix>.<letter>-v1.dkim.mail.microsoft
selector2._domainkey → selector2-<domain-with-dashes>._domainkey.<initial-prefix>.<letter>-v1.dkim.mail.microsoft<domain-with-dashes> is your domain with dashes instead of dots (example-com), <initial-prefix> is the variable part of your onmicrosoft.com domain, and <letter> is a character Microsoft assigns (for example n or r) that you cannot choose. Domains that already existed keep the old format, selector1-example-com._domainkey.example.onmicrosoft.com, and the two formats cannot coexist on the same selector2. That is why Microsoft insists: copy the exact value from the portal or PowerShell; the values in its documentation are illustrative.
Enabling it in the Microsoft Defender portal
- Open Email & collaboration > Policies & rules > Threat policies > Email authentication settings, or go straight to
https://security.microsoft.com/authentication?viewid=DKIM2. - On the DKIM tab, find your domain. Its status should be
NoDKIMKeysand the toggle disabled. - Try to switch the toggle on. An error appears containing the CNAME values; dismiss it. The status becomes
CnameMissing. - Open the domain's details and copy both values from Publish CNAMEs.
- At your DNS provider, create the two CNAMEs.
- After a while (Microsoft says a few minutes, possibly longer), return to the details and switch on Sign messages for this domain with DKIM signatures. The status should change to "Signing DKIM signatures for this domain"2.
Or with Exchange Online PowerShell
# Status and CNAME values for every domain
Get-DkimSigningConfig | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME
# If the domain is not listed: create the configuration with a 2048-bit key (the default is 1024)
New-DkimSigningConfig -DomainName example.com -Enabled $false -KeySize 2048
# Once both CNAMEs are published: turn signing on
Set-DkimSigningConfig -Identity example.com -Enabled $trueAll three cmdlets and the -KeySize parameter (1024 by default, or 2048) come from Microsoft's guide2. If Set-DkimSigningConfig cannot find the CNAMEs, it returns an error with the expected values: check the dashes, dots and underscores, wait and try again. To rotate keys later there is Rotate-DkimSigningConfig, and the change takes four days (96 hours) to take effect2.
Step 3: DMARC in phases
Before DMARC, Microsoft asks you to have SPF and DKIM configured on every domain and subdomain that sends from Microsoft 3653. The record is a TXT on the host _dmarc, which is mandatory.
Microsoft suggests starting with a low-volume domain or subdomain and moving up in phases3:
p=none: no action requested. You read the aggregate reports (rua) and fix the senders that fail.p=quarantine: failing mail is accepted but flagged, for example into the junk folder.p=reject: failing mail is rejected. This is the end goal for all your domains.
Two points from the documentation. With p=quarantine or p=reject, outbound Microsoft 365 mail that fails DMARC at the destination is routed through its high-risk delivery pool, and there is no override3. And aggregate reports usually arrive once a day as a compressed XML file that is hard to read by hand: Microsoft suggests automating it or using a DMARC reporting service3.
Microsoft's examples include pct=100. RFC 9989, published in May 2026 to replace the original DMARC specification, removed that tag and lists it as historic4; since 100 is also the default according to Microsoft, the example below leaves it out.
Do not forget the onmicrosoft.com domain if you do not send from it: Microsoft recommends publishing v=DMARC1; p=reject there from the Microsoft 365 admin centre, under Settings > Domains > your onmicrosoft.com domain > DNS records > Add record3.
The example records for example.com
This is the DNS zone for a domain added after May 2025, with the initial domain example.onmicrosoft.com. The letter n in the CNAMEs is illustrative: yours may be different.
example.com. 3600 IN TXT "v=spf1 include:spf.protection.outlook.com -all"
selector1._domainkey.example.com. 3600 IN CNAME selector1-example-com._domainkey.example.n-v1.dkim.mail.microsoft.
selector2._domainkey.example.com. 3600 IN CNAME selector2-example-com._domainkey.example.n-v1.dkim.mail.microsoft.
_dmarc.example.com. 3600 IN TXT "v=DMARC1; p=none; rua=mailto:dmarc@example.com"What does Outlook.com require from high-volume senders?
On 2 April 2025 Microsoft announced requirements for domains sending more than 5,000 messages a day to its consumer service, Outlook.com, which covers outlook.com, hotmail.com and live.com addresses5:
- Requirement
- SPF
- Detail
- Must pass for the sending domain
- Requirement
- DKIM
- Detail
- Must pass
- Requirement
- DMARC
- Detail
- At least
p=none, aligned with SPF or DKIM (preferably both)
- Requirement
- Recommended
- Detail
- A valid sender address that accepts replies, a visible working unsubscribe link, clean lists
Enforcement began on 5 May 2025. In an update on 29 April 2025, Microsoft dropped its original plan to send non-compliant mail to junk and decided to reject it with the error 550; 5.7.515 Access denied, sending domain [SendingDomain] does not meet the required authentication level.5 If you see that error in a bounce, the problem is your domain's authentication, not the recipient.
How to check it
- On a real message: send an email to an account on another system (Gmail or Outlook.com). Microsoft warns that messages within your own organisation carry no DKIM signature, and advises against testing with AOL2. In the header,
DKIM-Signatureshould showd=example.com, andAuthentication-Resultsshould showdkim=pass,spf=passanddmarc=pass. - With the header analyser: Microsoft points to the Message Header Analyzer at
https://mha.azurewebsites.netfor reading long headers2. - In PowerShell:
Get-DkimSigningConfigshould showEnabled: TrueandStatus: Validfor your domain2. - In DNS: look up the TXT records at the root and at
_dmarc.example.com, and the CNAMEs for both selectors, with any public DNS tool.
What SmoothSeen does with this
SmoothSeen queries the DNS of the domain you analyse and checks whether it has an SPF record and a DMARC record, and with which policy. It does not check DKIM: the public key lives at a name that depends on the selector, and although Microsoft 365 calls its selectors selector1 and selector2, other providers use different names that cannot be guessed from outside. For DKIM, the reliable proof is the header of a real message.
What to do this week
Run Get-DkimSigningConfig or open the DKIM tab in the Defender portal and check your custom domains show "Valid". If any is still at CnameMissing, publish the CNAMEs today and leave DMARC at p=none so you can read the first reports. Afterwards, to review the rest of your site, analyse it with SmoothSeen.
Frequently asked questions
Why does Microsoft recommend -all while Google recommends ~all?
Each provider applies its own reasoning. Google prefers mail from unlisted servers to be flagged as suspicious. Microsoft prefers -all because, according to its documentation, with ~all the DMARC policy has practically no effect on messages that fail SPF and carry no DKIM signature. If you use both services, publish a single SPF record with both include: statements.
Why do my DKIM CNAMEs look different from the tutorials?
Because Microsoft changed the format in May 2025. Domains added since then point to a name ending in dkim.mail.microsoft, with a letter Microsoft assigns; older domains still point to your onmicrosoft.com domain. Always copy the values from the Defender portal or from Get-DkimSigningConfig, never from an example.
Do I need DMARC for the onmicrosoft.com domain?
Microsoft recommends it. SPF and DKIM come preconfigured on that domain, but DMARC does not. If you do not send from it, publish v=DMARC1; p=reject from the Microsoft 365 admin centre, in the domains section under DNS records. That way nobody can successfully spoof it with servers that enforce DMARC.
What does error 550 5.7.515 mean?
It is Outlook.com rejecting a domain that sends it more than 5,000 messages a day without meeting its authentication requirements: SPF passing, DKIM passing and DMARC at p=none or stricter, aligned with one of the two. The fix lies in the DNS and DKIM signing of the sending domain, not in the recipient's mailbox.
Sources
- 1Set up SPF to identify valid email sources for your custom cloud domains, Microsoft Learn, updated 3 July 2026.
- 2Set up DKIM to sign mail from your cloud domain, Microsoft Learn, updated 3 July 2026.
- 3Set up DMARC to validate the From address domain for cloud senders, Microsoft Learn, updated 3 July 2026.
- 4RFC 9989: Domain-Based Message Authentication, Reporting, and Conformance (DMARC), IETF, May 2026.
- 5Strengthening Email Ecosystem: Outlook's New Requirements for High-Volume Senders, Microsoft Defender for Office 365 Blog, 2 April 2025, updated 29 April 2025.
How to cite this article
SmoothSeen. (2026, October 7). Microsoft 365 SPF, DKIM and DMARC: DNS records, the Defender portal and testing. https://smoothseen.com/en/blog/microsoft-365-spf-dkim-dmarc/
Keep reading
What is SEO? How search engine optimisation works and how to improve it in 2026
What SEO is, how Google decides which pages to show and a prioritised checklist to improve your rankings with free tools.
.htaccess force HTTPS: redirect to https, enable HSTS and add security headers in Apache
How to force HTTPS in .htaccess or an Apache VirtualHost, roll out HSTS safely and add security headers. Every snippet tested on Apache 2.4.69.
.htaccess gzip and Brotli: browser caching and blocking AI bots in Apache
How to enable gzip and Brotli, set browser caching and block AI training bots in Apache .htaccess without dropping out of ChatGPT search. Tested.