How to set up SPF, DKIM, and DMARC in Microsoft 365

Microsoft 365 handles much of email security for you, but SPF, DKIM, and DMARC for your own domain still need a few DNS records. Here's the order to do it in.

Updated

You'll need: admin access to Microsoft 365, and access to wherever your domain's DNS is hosted (registrar, web host, or a DNS service like Cloudflare).

1. SPF

Microsoft 365's SPF include is spf.protection.outlook.com. If Microsoft 365 is the only service that sends email for your domain, your record is:

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

If other services also send as you, add their includes to the same record. Don't create a second SPF record. See fixing SPF errors.

2. DKIM

Microsoft signs mail for your onmicrosoft.com domain automatically, but your custom domain needs DKIM turned on so the signature matches your From address.

  1. Open the Microsoft Defender portal (security.microsoft.com).
  2. Go to Email & collaboration > Policies & rules > Threat policies > Email authentication settings, and open the DKIM tab.
  3. Select your domain. Microsoft shows two CNAME records (for selector1._domainkey and selector2._domainkey).
  4. Add both CNAME records at your DNS host, copying the values exactly as Microsoft shows them. The targets are specific to your tenant.
  5. Wait for DNS to update (usually under an hour), then return to the DKIM tab and turn on Sign messages for this domain with DKIM signatures.

3. DMARC

Add a TXT record named _dmarc:

v=DMARC1; p=none; rua=mailto:dmarc@yourbusiness.com

Start at p=none to collect reports, then move to p=quarantine and p=reject once your legitimate email passes. The steps are in moving off p=none.

4. Check the result

A Nightkeep report checks SPF, DKIM (including Microsoft's selector1 and selector2), and DMARC in one go and tells you in plain English what's still missing.

On the Business and Complete plans, Nightkeep also checks your Microsoft 365 account security with read-only access: who has MFA, administrators without MFA, outside guests, inactive accounts, and your Microsoft Secure Score. It never reads email or files.

See how your domain does

Create a free account and get a report on your email security (SPF, DKIM, and DMARC), website certificate, domain registration, and website, graded A to F with plain-English fixes. It takes about ten seconds once you're signed up.

First report free. No credit card. Nothing to install.