To authenticate a custom domain in Microsoft 365 you need an SPF record containing include:spf.protection.outlook.com, two DKIM CNAME records (selector1 and selector2) followed by switching DKIM on in the Microsoft Defender portal, and a DMARC record. This guide covers each step using example.co.uk, explains the onmicrosoft.com domain, and shows how to add other services that send as you.
Microsoft's own bulk-sender requirements for Outlook.com, Hotmail and Live addresses took effect on 5 May 2025, alongside the Gmail and Yahoo rules that started in February 2024. All of them expect SPF, DKIM and DMARC. If you want the theory behind each, read our guides to SPF, DKIM and DMARC.
Step 1: publish your SPF record
When you add a domain to Microsoft 365, the setup wizard suggests an SPF record. For a domain that only sends through Exchange Online, it looks like this:
Type: TXT Host: @ Value: v=spf1 include:spf.protection.outlook.com -all
Microsoft's examples use -all (hard fail). ~all (soft fail) is also fine, particularly while you are still finding every service that sends as your domain. Once DMARC is enforcing, the difference between the two matters much less.
v=spf1 record. Leaving your old host's include in place after migration is a common oversight and wastes DNS lookups.Step 2: publish the two DKIM CNAME records
Microsoft 365 handles DKIM differently from most platforms. Instead of giving you a public key to paste into a TXT record, it asks you to publish two CNAME records that point at keys Microsoft hosts. This lets Microsoft rotate your keys without you touching DNS.
At the time of writing, you find the values in the Microsoft Defender portal:
- Go to security.microsoft.com and sign in as an administrator.
- Open Email & collaboration > Policies & rules > Threat policies.
- Choose Email authentication settings, then the DKIM tab.
- Select your custom domain. If no keys exist yet, choose the option to create DKIM keys.
- The panel shows two CNAME records to publish.
They look broadly like this, but the targets vary by tenant and Microsoft has changed the format over time, so always copy the exact values the portal shows you:
Type: CNAME Host: selector1._domainkey Value: selector1-example-co-uk._domainkey.yourtenant.onmicrosoft.com Type: CNAME Host: selector2._domainkey Value: selector2-example-co-uk._domainkey.yourtenant.onmicrosoft.com
selector1._domainkey as the host if the panel adds your domain automatically.Step 3: enable DKIM signing
Publishing the CNAMEs does nothing on its own. Back on the DKIM tab, open your domain and turn on the toggle to sign messages for this domain with DKIM signatures. If Microsoft cannot see the CNAMEs yet, it shows an error; wait for DNS to propagate and try again.
Once enabled, outgoing mail carries a signature with d=example.co.uk. Before this, Microsoft signs your mail with your onmicrosoft.com domain, which passes DKIM but does not align with your From address, so it does not help DMARC.
Step 4: add a DMARC record
Microsoft 365 does not create a DMARC record for custom domains. Add one yourself, starting in monitoring mode:
Type: TXT Host: _dmarc Value: v=DMARC1; p=none; rua=mailto:dmarc-reports@example.co.uk
Collect aggregate reports for a few weeks, fix any legitimate sender that fails, then move to p=quarantine and later p=reject. Our DMARC guide explains how to read the reports and when it is safe to tighten the policy.
What about the onmicrosoft.com domain?
Every Microsoft 365 tenant comes with an initial domain such as yourtenant.onmicrosoft.com. Microsoft manages SPF and DKIM for it, so it authenticates out of the box. It is still not suitable for business mail:
- It does not carry your brand, and recipients are more wary of it.
- It shares a namespace with every other tenant, so its reputation is not under your control.
- Microsoft has introduced limits on how much external mail can be sent from onmicrosoft.com addresses, to stop the domain being abused.
Make sure every user's primary address, and the default domain for the tenant, is your own authenticated domain. A frequent problem is a shared mailbox or an older account still sending as @yourtenant.onmicrosoft.com. The Microsoft 365 admin centre lets you check and change primary addresses for each user and group.
Adding third-party senders
Most businesses also send from other systems: a newsletter platform, a CRM, a helpdesk, an e-commerce shop or accounting software. Each one is a separate sending path that needs authenticating.
Combine SPF includes in one record
v=spf1 include:spf.protection.outlook.com include:servers.example-esp.com -all
Keep an eye on the ten-DNS-lookup limit; nested includes count towards it. Our guide to too many SPF lookups shows how to fix a record that has grown too big.
Set up DKIM with each provider
Many platforms send using their own return-path domain, so SPF is checked against their domain rather than yours. For DMARC to pass, the provider needs to sign with DKIM on your domain. Look for a "domain authentication" or "sender authentication" section in each service and publish the records it gives you.
Devices and applications relaying through Microsoft 365
Printers, scanners and line-of-business apps often send mail too. If they relay through Exchange Online using an authenticated account or a connector, the mail leaves Microsoft's servers and picks up your SPF and DKIM. If they send directly from your office network to the internet, they will fail authentication unless you account for them, and they are better routed through Microsoft 365 instead.
Domains, DNS & emaildijitul DNSRegister and transfer .uk and .com domains, with Cloudflare DNS management and business email. SPF, DKIM and DMARC set up properly.Fix your DNS with dijitulStep 5: test every sending path
Send a normal email from Outlook to the unique address on the Mail Tester UK home page. The report confirms whether SPF passed, whether the DKIM signature uses d=example.co.uk rather than your onmicrosoft.com domain, and whether DMARC aligned. Then repeat from each third-party service. A correctly set up message shows headers similar to:
Authentication-Results: mx.example.net; dkim=pass header.d=example.co.uk header.s=selector1; spf=pass smtp.mailfrom=you@example.co.uk; dmarc=pass header.from=example.co.uk
The test also runs the Outlook.com bulk-sender checks, which are covered in more depth in our Outlook sender requirements guide.
Quick checklist
- One SPF record including
spf.protection.outlook.com, with old providers removed. - Both
selector1andselector2CNAMEs published exactly as shown in Defender. - DKIM signing switched on for every custom domain that sends mail.
- A DMARC record at
_dmarcwith a report address. - No users or shared mailboxes sending as onmicrosoft.com.
- DKIM set up on your domain for every third-party sender.
Frequently asked questions
What SPF record does Microsoft 365 need?
A single TXT record on your root domain containing include:spf.protection.outlook.com, for example v=spf1 include:spf.protection.outlook.com -all. Add any other sending services to the same record.
Why does Microsoft 365 DKIM need two CNAME records?
Microsoft uses two selectors, selector1 and selector2, so it can rotate keys. One is active while the other is prepared, and the CNAMEs let Microsoft change the keys without you editing DNS again.
Is DKIM enabled by default in Microsoft 365?
Only for the onmicrosoft.com domain. For your own custom domain you must publish the two CNAME records and then enable DKIM signing for that domain in the Defender portal.
Can I send business email from my onmicrosoft.com address?
You should not. It is meant as a technical fallback, it does not carry your brand, and Microsoft limits how much external mail it can send. Add and authenticate your own domain instead.