Microsoft 365 (still often called Office 365) runs your email, but it doesn't finish the job of proving that email is really yours. Most importantly, until you set up DKIM for your own domain, Microsoft signs your messages with your tenant's onmicrosoft.com address instead. That signature doesn't match your domain, so it doesn't help you pass DMARC.
Without SPF, DKIM and DMARC for your domain, your messages are more likely to land in spam, and Gmail, Yahoo and Microsoft all require them from anyone sending email in volume. Setup takes about 15 minutes of work, plus some waiting for DNS.
Before you start
- Your domain added and verified in Microsoft 365. In the Microsoft 365 admin center, go to Settings → Domains and check that it shows as verified. Unverified domains don't appear on the DKIM page.
- An admin role that can open the Defender portal, such as Security Administrator or Global Administrator, to set up DKIM.
- Access to your DNS host, wherever your domain's DNS records are managed (Cloudflare, GoDaddy, Namecheap, Route 53 and so on). This isn't always where you bought the domain. Rigcheck shows your DNS host at the top of your results.
Step 1: SPF
SPF lists the servers allowed to send email for your domain. For Microsoft 365, add this TXT record at the root of your domain (the name is usually @):
@TXTv=spf1 include:spf.protection.outlook.com ~allMicrosoft's own examples end in -all rather than ~all. Either works once DKIM and DMARC are in place, since DMARC is what decides what happens to failing mail. ~all is the more forgiving choice while you're still finding every service that sends for you.
If you already have an SPF record, don't add a second one. A domain can only have one, and two records cause SPF to fail completely. Instead, add include:spf.protection.outlook.com to your existing record, before the ~all at the end. For example, if your website also sends mail (contact forms, order emails) from its own server:
@TXTIf your record is getting long, read SPF too many DNS lookups. Each include uses part of a limited budget.
If mail you send bounces with 550 5.7.23, the receiver rejected it because SPF failed. Fixing 550 5.7.23 shows how to find the sender that's missing from your record.
Step 2: DKIM
DKIM adds a digital signature to every message, which receivers check against a public key in your DNS. It's the most important of the three, because it survives forwarding and it's what most often makes DMARC pass.
Microsoft 365 does DKIM differently from most providers. Instead of giving you a long key to paste into a TXT record, it gives you two CNAME records that point back to keys Microsoft manages. That's what lets Microsoft rotate your keys later without you touching DNS again. You need both records, even though only one is used at a time.
For what each part of the two records means and how rotation works, see Office 365 DKIM CNAME records explained. For the PowerShell route and a 2048-bit key, see how to set up DKIM in Office 365.
Get the records from the Defender portal
- Go to the Microsoft Defender portal at
security.microsoft.comand open Email & collaboration → Policies & rules → Threat policies → Email authentication settings. - Select the DKIM tab, then click your custom domain. Don't pick the
onmicrosoft.comentry, which is already signed. - If the domain has never had DKIM set up, click Create DKIM keys.
- Under Publish CNAMEs, copy both records exactly as shown.
Add them to your DNS
At your DNS host, create two CNAME records. For a domain set up recently, they look like this, with your own domain in place of yourdomain.com:
selector1._domainkeyCNAMEselector1-yourdomain-com._domainkey.yourdomain.n-v1.dkim.mail.microsoftselector2._domainkeyCNAMEselector2-yourdomain-com._domainkey.yourdomain.n-v1.dkim.mail.microsoftDomains that had DKIM set up before mid-2025 use an older format ending in your onmicrosoft.com address. Both formats work. Either way, copy the values from the portal rather than typing them out. The exact characters vary between tenants, and a single wrong dot or dash breaks signing.
Enter just selector1._domainkey and selector2._domainkey in the name fields. Most DNS hosts add your domain automatically, and typing the full name can produce selector1._domainkey.yourdomain.com.yourdomain.com, which silently fails.
If your DNS is on Cloudflare, set both records to DNS only (grey cloud), not proxied.
Once they're added, the Office 365 DKIM checker confirms both records point to Microsoft and catches the mistakes listed below.
Turn on signing
Back in the Defender portal, open your domain on the DKIM tab again and switch Sign messages for this domain with DKIM signatures to Enabled. This step is easy to miss: publishing the records alone doesn't make Microsoft sign your mail with your domain.
If you get an error saying the CNAME record doesn't exist, wait and try again. New DNS records can take anywhere from a few minutes to a few hours to appear. Once Microsoft finds them, the status changes to Valid.
Step 3: DMARC
DMARC tells receivers what to do with mail that fails SPF and DKIM, and sends you reports about who's sending as your domain. Add a TXT record named _dmarc:
_dmarcTXTv=DMARC1; p=none; rua=mailto:dmarc@yourdomain.comReplace the address with an inbox you'll check. Start with p=none so nothing gets blocked while you confirm everything passes, then tighten it over the following weeks. For the full rollout, follow Office 365 DMARC setup, step by step, which also covers the DMARC record for your onmicrosoft.com domain.
Step 4: Confirm it works
- Run your domain through Rigcheck. SPF should pass, DKIM should show a key for
selector1orselector2, and DMARC should be in place. - Send a message from your Microsoft 365 mailbox to a personal Gmail address. Open it, tap the three-dot menu and choose Show original. You should see PASS next to SPF, DKIM and DMARC.
- While you're in the original message, find the
DKIM-Signatureline and check thed=value. It should be your domain, notonmicrosoft.com.
Other problems
- Mail from other tools still fails. These records only cover mail sent through Microsoft 365. Your website's contact form, CRM, help desk and newsletter tool each need their own authentication set up in their settings.
Sending app email through Microsoft 365
A common shortcut is to send your app's or website's email (password resets, receipts, notifications) through a Microsoft 365 mailbox using SMTP. It works at first, but it has real downsides:
- Sending limits. Microsoft caps how many recipients each mailbox can send to per day. Go over, and that mailbox can be blocked from sending until the limit resets, including for the person who uses it.
- Sign-in changes. Microsoft is retiring basic username-and-password sign-in for sending mail by SMTP. As of November 2026, its timeline turns it off by default for existing tenants at the end of December 2026. Older apps, plugins and devices that send that way stop working then (SMTP 535 authentication failed covers the alternatives).
- Shared reputation. A surge of automated mail or spam complaints affects the same mailbox and domain your team uses for everyday email.
- No visibility. You won't get delivery logs, bounce handling or the analytics you need to debug "I never got the reset email."
The more reliable setup is a dedicated transactional email service, sending from a subdomain like mail.yourdomain.com with its own SPF and DKIM. Your team's mailboxes and your app's email then can't affect each other. To pick one, see transactional email providers compared: free plans, prices and who each one suits.