Guides › Microsoft 365 / Exchange Online + Mailgun

SPF record for Microsoft 365 / Exchange Online + Mailgun

Sending from both Microsoft 365 / Exchange Online and Mailgun? You need one SPF record that authorises both. Two separate SPF records break SPF entirely.

Publish this single TXT record at your root domain (@), replacing any existing v=spf1 record:
v=spf1 include:spf.protection.outlook.com include:mailgun.org ~all
Total DNS lookups: 6 lookups

Microsoft 365 / Exchange Online: 1 · Mailgun: 5 · limit: 10. Measured live.

DKIM for both

Microsoft 365 / Exchange Online

Two CNAME records, selector1._domainkey and selector2._domainkey, pointing to the values shown in the Microsoft Defender portal (Email authentication settings → DKIM).

Mailgun

TXT record at a selector Mailgun generates (shown under Sending → Domains → DNS records).

Then add DMARC

TXT record at _dmarc
v=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com;

Verify your Microsoft 365 / Exchange Online + Mailgun setup