Guides · Updated October 29, 2026 · Not legal advice; provider rules change, so check the linked sources.
How to set up DKIM for Microsoft 365 (custom domain)
Microsoft 365 signs mail from your yourcompany.onmicrosoft.com address automatically, but not mail from your own domain until you publish two DNS records and switch signing on (Microsoft's DKIM guide). Without it, DMARC can only pass through SPF, and forwarded mail or a strict DMARC policy can send your messages to spam.
1. Get your exact CNAME values
Don't build the values by hand. Microsoft changed the format for domains added from May 2025, and older domains keep the old format, so copy what your tenant shows you:
- Defender portal: open Email authentication settings, DKIM tab, select your domain and copy the two values under "Publish CNAMEs". If the status is "No DKIM keys", try the toggle first; it shows an error with the values and the status becomes CnameMissing.
- Exchange Online PowerShell:
Get-DkimSigningConfig -Identity yourdomain.com | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME
If the domain isn't listed, create the keys first with New-DkimSigningConfig -DomainName yourdomain.com -Enabled $false, then run the command above again.
The values look like one of these, with your own domain (dots turned into dashes) and tenant name:
selector1._domainkey CNAME selector1-yourdomain-com._domainkey.yourtenant.n-v1.dkim.mail.microsoft
selector2._domainkey CNAME selector2-yourdomain-com._domainkey.yourtenant.n-v1.dkim.mail.microsoft
(older domains) CNAME selector1-yourdomain-com._domainkey.yourtenant.onmicrosoft.com
2. Publish both records at your DNS host
- Create both
selector1._domainkeyandselector2._domainkey. Only one is used at a time, but the second is needed for key rotation. - Use CNAME records, not TXT. Microsoft manages and rotates the keys behind them.
- In the name field enter only
selector1._domainkey. Most hosts (GoDaddy, Cloudflare, Namecheap, Porkbun) add your domain automatically, so typing the full name createsselector1._domainkey.yourdomain.com.yourdomain.com. - On Cloudflare, set the records to DNS only (grey cloud). On Amazon Route 53, end the target with a trailing dot.
- A TTL of one hour (3600) is fine.
3. Turn signing on
Once DNS has updated (minutes, sometimes longer), go back to the DKIM tab and switch on "Sign messages for this domain with DKIM signatures", or run:
Set-DkimSigningConfig -Identity yourdomain.com -Enabled $true
If it still says CnameMissing, check the records with dig CNAME selector1._domainkey.yourdomain.com +short (or nslookup -type=CNAME on Windows) and compare them character by character with the values from step 1.
4. Confirm it works
- Send a message from your domain to a Gmail or Outlook.com address (not to your own domain, which skips the signature) and check the headers: you want
dkim=passwithheader.d=yourdomain.com. See how to check SPF, DKIM and DMARC. - Other services that send as your domain (newsletters, CRMs, invoicing) need their own DKIM setup in those tools. Microsoft's DKIM only covers mail that leaves through Microsoft 365.
- With DKIM aligned, you can move DMARC toward enforcement safely. See DMARC basics, and if your SPF is crowded, fixing SPF lookup limits.
Want to know if DKIM is actually on? Run the free ExclusiveTrust scan. If you'd rather not touch DNS yourself, our managed fix sets up SPF, DKIM and DMARC for you, and Trust Monitor re-checks your records daily so a change doesn't quietly break them.