Microsoft 365 Email Authentication Guide

How to set up SPF, DKIM, DMARC, and List-Unsubscribe for Microsoft 365. Provider-specific DNS records, step-by-step instructions, and the mistakes to avoid.

Check your domain while following this guide

Run a free SPF, DKIM, and DMARC check to see what is passing and what still needs fixing.

No signup required. Works on any domain.

Before you start

  • You need access to the DNS settings for your domain. This is usually at your domain registrar or DNS provider (Cloudflare, Namecheap, GoDaddy, etc.).
  • You need admin or settings access to your Microsoft 365 account to generate DKIM keys and verify records.
  • DNS changes take time to propagate. After saving a record, wait at least 15-30 minutes before testing.

SPF Setup for Microsoft 365

SPF (Sender Policy Framework) is a DNS TXT record that lists which mail servers are allowed to send email on behalf of your domain. Receiving servers check it to decide whether to accept or flag your mail.

Microsoft 365 uses a single include that covers all Microsoft sending infrastructure across data centers. Check for an existing SPF record before adding anything.

SPF record for Microsoft 365

Type: TXT    Host/Name: @    Value: v=spf1 include:spf.protection.outlook.com ~all

Steps

  1. Open your DNS provider and look for an existing TXT record at host @ that starts with v=spf1.
  2. If one exists, edit it and add the new include. Never create a second SPF record. If none exists, create a new TXT record at @ with the value above.
  3. If you also use HubSpot, Marketo, or Salesforce for marketing email, add their includes to the same record rather than creating a separate one.
  4. Use ~all (softfail) while testing. Move to -all (hardfail) only after confirming all legitimate senders are covered.
  5. Save and wait for DNS propagation.
Watch out: Microsoft 365 SPF only covers mail routed through Exchange Online. Third-party tools sending on your behalf need their own include in this same record.

DKIM Setup for Microsoft 365

DKIM (DomainKeys Identified Mail) adds a cryptographic signature to outgoing email. Receiving servers verify the signature against a public key you publish as a DNS TXT record. A valid DKIM signature proves the message was not altered in transit and that it came from an authorized sender.

Selector for Microsoft 365: selector1 and selector2 (Microsoft manages key rotation between them)

Steps

  1. In the Microsoft 365 Defender portal, go to Email & Collaboration → Policies & Rules → Threat Policies → Email Authentication Settings → DKIM.
  2. Select your domain and click "Enable". Microsoft shows two CNAME records to publish.
  3. Add both CNAME records to your DNS provider. They point to Microsoft's key infrastructure, not a key value you can copy.
  4. Return to the Defender portal. Once the CNAMEs resolve, click "Enable" and DKIM signing activates.
Watch out: Microsoft 365 uses CNAME records for DKIM, not a TXT key value. Do not try to generate or enter a key manually.

Verify DKIM

  • Send a test email to a Gmail address and open it. Click the three-dot menu → "Show original". Look for dkim=pass in the authentication results.
  • From the command line:
    dig TXT selector._domainkey.yourdomain.com +short
  • Or use the InboxGreen DKIM checker.

DMARC Setup for Microsoft 365

DMARC (Domain-based Message Authentication, Reporting, and Conformance) ties SPF and DKIM together. It tells receiving servers what to do with mail that fails both checks, and sends you reports about who is sending email on behalf of your domain. DMARC also requires alignment: the domain in your visible From header must match the domain authenticated by SPF or DKIM.

Microsoft 365 CNAME-based DKIM aligns correctly with your From domain once enabled in Defender. Check DMARC reports for 2-4 weeks at p=none before tightening the policy.

The three-stage approach

StageDNS valueWhen to use it
Monitor v=DMARC1; p=none; rua=mailto:[email protected]; fo=1 Start here. Collects reports without blocking any mail.
Quarantine v=DMARC1; p=quarantine; pct=25; rua=mailto:[email protected]; fo=1 After 2-4 weeks at p=none with clean reports. Sends some failing mail to spam.
Reject v=DMARC1; p=reject; pct=100; rua=mailto:[email protected]; fo=1 Full protection once SPF and DKIM alignment is verified.

Publish the DMARC record

  1. Create a TXT record at host _dmarc (not @) with the p=none value above.
  2. Replace [email protected] with a real inbox that can receive XML report emails.
  3. Wait for DNS propagation, then verify with dig TXT _dmarc.yourdomain.com +short.
  4. After 2-4 weeks, review the reports and tighten the policy when alignment looks healthy.
Why DMARC fails even when SPF and DKIM pass: DMARC cares about alignment. The domain in the visible From header must match the domain SPF or DKIM authenticated. Forwarded mail and mailing list services often break alignment.

List-Unsubscribe for Microsoft 365

The List-Unsubscribe header gives inbox providers like Gmail and Outlook a machine-readable way to offer a one-click unsubscribe button. When it is present and valid, Gmail shows an "Unsubscribe" link next to the sender name without the recipient needing to scroll to the bottom of the email. This reduces spam complaints and protects your sender reputation.

How to enable it

  1. In your sending platform or email template, enable the List-Unsubscribe header option. Most platforms (SendGrid, Mailgun, Brevo, Shopify Email) have a toggle or a macro for this.
  2. Use a one-click HTTPS unsubscribe URL as the primary method. Include a mailto: address as fallback.
  3. Add the List-Unsubscribe-Post header to declare one-click support (required by Gmail's February 2024 guidelines for senders above 5,000 messages/day).

Example headers

List-Unsubscribe: <https://yourdomain.com/unsubscribe/TOKEN>, <mailto:[email protected]?subject=unsubscribe>
List-Unsubscribe-Post: List-Unsubscribe=One-Click

Common mistakes

  • Using a broken or expired token in the unsubscribe URL. Inbox providers test the link periodically.
  • Only providing a mailto: link without a one-click HTTPS URL. Gmail and Outlook prefer the HTTPS method.
  • Not honoring the unsubscribe request immediately. Gmail requires that one-click unsubscribes are processed within two business days.

To verify, send a test email to a Gmail address and look at "Show original". You should see the List-Unsubscribe header in the raw message headers.

Verify All Four Records

After publishing all records, run these checks:

RecordCommandWhat to look for
SPF dig TXT yourdomain.com +short One TXT record starting with v=spf1
DKIM dig TXT selector._domainkey.yourdomain.com +short A TXT record starting with v=DKIM1
DMARC dig TXT _dmarc.yourdomain.com +short A TXT record starting with v=DMARC1
All three InboxGreen Free Check Green pass on SPF, DKIM, and DMARC

Common Mistakes with Microsoft 365

  • Skipping the DKIM signing enable step in Defender after adding the two CNAME records. CNAMEs alone do not activate signing.
  • Trying to add a plain TXT DKIM key value instead of the CNAME records Microsoft requires.
  • Forgetting to include other senders like HubSpot or Marketo in the SPF record when they send on behalf of your Microsoft 365 domain.

Free Deliverability Scan

Check SPF, DKIM, DMARC and List-Unsubscribe for your domain in seconds.

Useful tools