A step-by-step guide to setting up SPF, DKIM, and DMARC for organisations using Microsoft 365 (Exchange Online). Microsoft provides built-in support for email authentication, but you need to configure the DNS records and enable DKIM signing.
Step 1: Configure SPF
Microsoft 365 requires an SPF record that authorises their mail servers. Add this TXT record to your domain’s DNS:
Host/Name:
@Value:
v=spf1 include:spf.protection.outlook.com -allTTL:3600 (or default)
Add other includes alongside Microsoft’s. Example with Mailchimp:
Watch the 10-lookup limit — Microsoft’s include uses 2–3 lookups.
Step 2: Configure DKIM
Microsoft 365 can sign outgoing emails with DKIM using your custom domain. This requires publishing two CNAME records and enabling signing in the admin portal.
Add DKIM CNAME Records to DNS
Add two CNAME records that point to Microsoft’s DKIM key hosting:
Host/Name:
selector1._domainkeyValue:
selector1-yourdomain-com._domainkey.yourdomain.onmicrosoft.com
Record 2:
Host/Name:
selector2._domainkeyValue:
selector2-yourdomain-com._domainkey.yourdomain.onmicrosoft.com
yourdomain-com with your actual domain using hyphens instead of dots. For example, example.com becomes example-com.
Enable DKIM Signing in Microsoft 365
- Go to the Microsoft Defender portal (security.microsoft.com)
- Navigate to Email & collaboration → Policies & rules → Threat policies → Email authentication settings → DKIM
- Select your custom domain
- Toggle “Sign messages for this domain with DKIM signatures” to Enabled
- If you get an error about CNAME records, wait for DNS propagation and try again
selector1 to selector2 (and vice versa) without any downtime.
Step 3: Configure DMARC
Add a DMARC record to start monitoring:
Host/Name:
_dmarcValue:
v=DMARC1; p=none; rua=mailto:your-selector@dmarccloud.com; adkim=r; aspf=rTTL:3600
Use our DMARC Record Generator to customise your record. Start with p=none and progress to enforcement once reports confirm everything is clean. See Moving from p=none to p=reject.
Verify Your Setup
- Use our Domain Checker to verify all three records
- Send a test email to an external Gmail account
- In Gmail, click the three dots → “Show original”
- Look for
spf=pass,dkim=pass, anddmarc=pass
Common Microsoft 365 Issues
The most common cause is incorrect formatting. The host should be just
selector1._domainkey, not selector1._domainkey.yourdomain.com (most DNS providers append the domain automatically).
Shared mailboxes and distribution groups send through the same Exchange Online infrastructure and are covered by the same SPF record. If failing, check that the “Send As” address matches your domain.
If you have a hybrid Exchange setup, on-premises servers also need to be included in SPF. Add the public IP of your on-premises mail server:
ip4:YOUR.SERVER.IP.
Microsoft 365 now has a built-in DMARC management feature in the Defender portal. This can complement but does not replace publishing your own DNS records. You still need the TXT records in DNS.
Summary Checklist
- ☐ SPF TXT record at
@withinclude:spf.protection.outlook.com - ☐ Only one SPF record per domain
- ☐ DKIM CNAME records:
selector1._domainkeyandselector2._domainkey - ☐ DKIM signing enabled in Microsoft Defender portal
- ☐ DMARC TXT record at
_dmarcwithp=none - ☐ Test email confirms SPF PASS, DKIM PASS, DMARC PASS
- ☐ Aggregate reports arriving after 24–48 hours