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

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 -all

GCC 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:

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:

  1. 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.
  2. Try to switch the custom domain's toggle to Enabled. An error dialog appears; close it. The domain's status is now CnameMissing.
  3. Open the domain's details and copy the two values under Publish CNAMEs.
  4. At your DNS host, create two CNAME records, selector1._domainkey and selector2._domainkey, pointing to those values.
  5. 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:

  1. Publish a TXT record at _dmarc with p=none and a rua=mailto: address for aggregate reports, and watch the reports (reading aggregate reports).
  2. Move to p=quarantine once the reports show your legitimate mail passes.
  3. 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.com

Microsoft'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.

Sources

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.

Get up to 500 free credits. No card needed.

New accounts get 500 free credits (100 when you sign up with a free email provider such as Gmail, Outlook or Yahoo, another personal mailbox such as a paid one like Fastmail or one from your internet provider, or an address from a relay or alias service). Try it on your own list before you buy.

Updated · Maintained by: Email Validation LLC