Guide · Authentication: SPF, DKIM, DMARC
Set up SPF, DKIM and DMARC for Microsoft 365
To authenticate mail from your own domain in Microsoft 365, you publish three things at your DNS host: one SPF TXT record that includes spf.protection.outlook.com (in the commercial cloud and GCC; other Microsoft clouds use other values, see step 1), two DKIM CNAME records whose exact targets Microsoft generates for your domain, and a DMARC TXT record at _dmarc. You create SPF and DMARC where your domain's DNS is hosted: at your registrar or DNS host, or in the Microsoft 365 admin center only if Microsoft 365 hosts that DNS zone. DKIM signing for a custom domain is also off until you turn it on in the Defender portal. This guide walks through the steps as Microsoft documents them.
- Reading time
- 5 min
Before you start
- The
*.onmicrosoft.comdomain is already done. Microsoft maintains SPF for it and DKIM-signs its mail automatically. It still needs a DMARC record, which you add in the Microsoft 365 admin center. - Each sending subdomain needs its own records. The SPF record for
contoso.comdoesn't covermarketing.contoso.com, and each subdomain you send from needs its own DKIM configuration. DMARC is different: a subdomain without its own DMARC record inherits the parent domain's. - Use a subdomain for services you don't control. Microsoft recommends sending bulk mail from services such as an email marketing platform from a subdomain, so their problems don't affect the reputation of your main domain.
Step 1: SPF
Microsoft's SPF article gives this record for a domain whose only source of mail is Microsoft 365 (commercial cloud and GCC):
v=spf1 include:spf.protection.outlook.com -allGCC High, DoD and the cloud operated by 21Vianet use other values, listed in the same article's examples. If other systems also send as your domain, add their ip4:, ip6: or include: values to that same record. The rules Microsoft lists:
- One SPF record per domain or subdomain. Two records make SPF return
permerror. -allis recommended for Microsoft 365 domains, because Microsoft also recommends DKIM and DMARC.- At most 10 DNS lookups.
include:,a,mx,existsandredirecteach count;ip4:,ip6:andalldo not, and nested includes add more (the SPF lookup limit). Microsoft advises against flattening its own include, because its sending IP addresses change frequently. - TTL of at least 3600 seconds (one hour), to avoid DNS lookup timeouts.
Step 2: DKIM
Microsoft's DKIM article says no DKIM signing occurs for outbound mail from a custom domain until you configure it. The steps:
- In the Defender portal, open Email & collaboration > Policies & rules > Threat policies > Email authentication settings (or go to
https://security.microsoft.com/authentication) and select the DKIM tab. - Try to switch the custom domain's toggle to Enabled. An error dialog appears; close it. The domain's status is now CnameMissing.
- Open the domain's details and copy the two values under Publish CNAMEs.
- At your DNS host, create two CNAME records,
selector1._domainkeyandselector2._domainkey, pointing to those values. - After Microsoft detects them (a few minutes or longer), turn on Sign messages for this domain with DKIM signatures.
Copy the targets rather than typing them. Microsoft introduced a new target format for new custom domains in May 2025, ending in dkim.mail.microsoft with a character it assigns to your domain, while existing domains keep the older format under onmicrosoft.com. The two formats can't coexist for the same selector. In Exchange Online PowerShell, Get-DkimSigningConfig -Identity <domain> | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME shows the exact values. Only one selector signs at a time; the other is used after a key rotation (DKIM selectors and key rotation).
Step 3: DMARC
Microsoft's DMARC article says a message passes DMARC if SPF or DKIM passes with a domain aligned to the From address, and fails only if both fail. It recommends a gradual rollout, starting with a low-volume domain or subdomain and leaving the parent domain for last:
- Publish a TXT record at
_dmarcwithp=noneand arua=mailto:address for aggregate reports, and watch the reports (reading aggregate reports). - Move to
p=quarantineonce the reports show your legitimate mail passes. - Move to
p=reject.
A starting record looks like this (use a mailbox you read, ideally a shared mailbox or group rather than a person's):
v=DMARC1; p=none; rua=mailto:dmarc-reports@example.comMicrosoft's examples still include pct= for a percentage rollout. RFC 9989, which replaced RFC 7489 in May 2026, removed the pct tag, so don't count on receivers applying a percentage (moving from p=none to p=reject).
Two Microsoft details worth knowing: outbound mail from a Microsoft 365 domain with p=quarantine or p=reject that fails DMARC at the destination is routed through Microsoft's high-risk delivery pool, and Microsoft 365 sends DMARC aggregate reports for inbound mail only when the receiving domain's MX record points directly to Microsoft 365.
Step 4: test
Send a message from each system that uses your domain to a mailbox you control outside your organization, and read its Authentication-Results header. Check that spf or dkim passes, that smtp.mailfrom or header.d shares the From domain's organizational domain, and that dmarc=pass. Microsoft's article walks through a header where SPF and DKIM both pass for a vendor's domain but DMARC fails because neither aligns with the From address.
Questions
Can I manage SPF or DMARC records in the Microsoft 365 admin center?
Only if Microsoft 365 hosts your domain's DNS: then you add TXT records under Settings > Domains > DNS records. Otherwise you create them at your domain registrar or DNS host; Microsoft's SPF article says there are no admin portals or PowerShell cmdlets in Microsoft 365 to manage them there. The DMARC record of the *.onmicrosoft.com domain is added in the admin center.
What should I publish for a domain that never sends mail?
Microsoft's articles give v=spf1 -all as the SPF record and v=DMARC1; p=reject; as the DMARC record for a parked domain, and recommend no DKIM records for it.
Does ~all work as well as -all?
DMARC treats both as SPF failures, but Microsoft notes that the DMARC policy is effectively ignored for ~all failures on messages without DKIM signatures, which is why it recommends -all.
Try it
Check your records with the free SPF checker, DKIM checker and DMARC checker.
Related
- Outlook.com sender requirements: what Microsoft's consumer mailboxes expect from bulk senders.
- Glossary: DMARC policy.
Related guides
- Outlook.com requirements for high-volume senders
- Moving DMARC from p=none to p=reject
- The SPF 10-lookup limit explained
- DKIM selectors and key rotation
- How to read DMARC aggregate reports
- All guides
Sources
- Microsoft Learn: Set up SPF for your Microsoft 365 domain: the record, one record per domain,
-all, the 10-lookup limit, TTL and flattening. - Microsoft Learn: How to use DKIM for email in your custom domain: the Defender portal steps, CnameMissing, the CNAME formats and
Get-DkimSigningConfig. - Microsoft Learn: Set up DMARC to validate email in Microsoft 365: alignment, the rollout, reports, the high-risk delivery pool and parked domains.
- RFC 9989: DMARC, replacing RFC 7489; the
pcttag removed.
How we wrote this: drafted by the email-validation.org team with the help of AI writing tools, from our product documentation and the sources linked in the text.