The exact SPF record
Copy the example that matches your setup. Each one is a single TXT record; the host is shown as your DNS provider usually expects it (@ means the domain itself).
On a Mailgun sending subdomain (for example mg.example.com)
Type: TXT · Host: mg · 5 of 10 DNS lookups
v=spf1 include:mailgun.org ~all
Your main domain on Microsoft 365 stays as it is
Type: TXT · Host: @ · 1 of 10 DNS lookups
v=spf1 include:spf.protection.outlook.com -all
If you verify your main domain in Mailgun and use Google Workspace
Type: TXT · Host: @ · 6 of 10 DNS lookups
v=spf1 include:_spf.google.com include:mailgun.org ~all
How SPF applies to Mailgun mail
Receivers check SPF against the domain in the envelope sender (the MAIL FROM or bounce address). Mailgun sends with your own domain there, so its include belongs in the SPF record on the domain you send from.
- Mailgun says verified domains aren't subject to a sending limit of 300 emails a day and lose the "sent via Mailgun.org" notice.
- At 5 lookups,
include:mailgun.orgon your main domain next to Microsoft 365 or Google Workspace leaves room for few other senders. A subdomain gets its own 10-lookup budget.
How to add it
- Add your sending domain in Mailgun. A subdomain like
mg.example.comkeeps Mailgun traffic separate from your main domain's reputation. - Copy the DNS records from the Domain Verification & DNS section of the Mailgun control panel.
- Publish the SPF TXT record, the DKIM TXT record, the tracking CNAME and the two MX records (
mxa.mailgun.organdmxb.mailgun.org, priority 10) on that domain. - Verify the domain in Mailgun, then check it with the SPF Checker below.
DKIM and DMARC alignment
Mailgun's DKIM record is a TXT record you copy from the control panel. A subdomain such as mg.example.com still aligns with mail sent from example.com under DMARC's default relaxed alignment, for both SPF and DKIM (RFC 9989 section 4.4).
DMARC passes when SPF or DKIM passes and the domain it checked matches your From domain. Our guide to SPF, DKIM and DMARC explains how the three fit together.
Common mistakes
- Two SPF records. A domain may publish only one record that starts with
v=spf1. With two, receivers return a permanent error and SPF fails for all your mail (RFC 7208 section 3.2). Merge every sender into one record. - More than 10 DNS lookups. Each
include,a,mx,existsandredirectcosts a lookup, nested ones included; over 10 is a PermError (section 4.6.4). Mailgun's include costs 5 on its own. See how to fix too many SPF lookups. - Choosing
~allor-allwithout a plan. Mailgun's documentation uses~all.-allasks receivers to reject unlisted servers;~allasks them to accept but mark the mail. Once DMARC is enforced, receivers act on DMARC instead. Read SPF soft fail vs hard fail before you choose. - Adding
include:mailgun.orgto your main domain when you only verifiedmg.example.comin Mailgun. SPF is checked on the domain Mailgun sends from, so the main-domain include costs 5 lookups for nothing.
Check your SPF record
See your live record, every nested include and the real lookup count. Free, reads public DNS only.
Building a new record? Open the SPF Record Generator with Mailgun filled in.
Frequently asked questions
What is the SPF record for Mailgun?
v=spf1 include:mailgun.org ~all, published as a TXT record on the domain you verify in Mailgun. If that domain already has an SPF record, add the include to it instead of creating a second one.
Should I put Mailgun's SPF on my main domain or a subdomain?
Mailgun recommends that customers send from a subdomain, such as mg.example.com. The SPF record then goes on that subdomain, your main domain's record stays unchanged, and the subdomain has its own 10-lookup budget.
Why does include:mailgun.org use so many lookups?
It nests Mailgun's US and EU records, which nest further records. We measured 5 lookups on 9 October 2026. Check your total with the SPF Checker before adding it next to other providers.
Sources
- Mailgun Documentation: Domain verification
- Mailgun blog: The basics of email subdomains
- RFC 9989 section 4.4: Identifier alignment explained
- RFC 7208: Sender Policy Framework (SPF)
Values checked against Mailgun's documentation on October 9, 2026. Lookup counts measured with our SPF Checker on October 9, 2026; providers change their records, so check yours before relying on a number.
SPF records for other providers
- Microsoft 365include:spf.protection.outlook.com
- Google Workspaceinclude:_spf.google.com
- Zoho Mailinclude:zoho.com
- GoDaddyinclude:secureserver.net
- Fastmailinclude:spf.messagingengine.com
- Proton Mailinclude:_spf.protonmail.ch
- Amazon SESinclude:amazonses.com
- SendGridinclude:sendgrid.net
- PostmarkNone needed
- MailchimpNone needed
- BrevoNone for standard sending; spf.brevo.com with a dedicated IP
- HubSpotAccount-specific (copy from HubSpot)
- KlaviyoNone needed
- Salesforceinclude:_spf.salesforce.com
- Zendeskinclude:mail.zendesk.com
- Freshdeskinclude:email.freshdesk.com
- IntercomNone needed
Related guides
SPF record syntax and examples
SPF record syntax explained: mechanisms, qualifiers and modifiers, with copy-ready examples for Microsoft 365, Google Workspace, subdomains and parked domains.
9 min read SPF, DKIM & DMARCHow to fix SPF PermError: too many DNS lookups
Why SPF breaks at 10 DNS lookups, how to count them, and step-by-step fixes for Microsoft 365 and Google Workspace domains with many senders.
8 min read SPF, DKIM & DMARCSPF softfail vs hardfail: should you use ~all or -all?
What ~all, -all and ?all mean in SPF, what receivers really do with each, how DMARC changes the choice, and which one to use for sending and parked domains.
8 min readLast updated