All articles
    Deliverability

    How to Set Up an SPF Record for Mailgun

    To set up SPF for Mailgun, add one TXT record at your sending domain containing v=spf1 include:mailgun.org ~all, then confirm it with dig. Mailgun's…

    VeriMailX Team November 23, 2026 3 min read

    Key takeaways

    • In the Mailgun control panel, add your sending domain under Sending, then Domains.
    • Open the domain's DNS records and copy the SPF value shown there, which the verification page gives as v=spf1 include:mailgun.org ~all.
    • Create a TXT record at the name Mailgun shows (usually the domain or a subdomain you send from).

    To set up SPF for Mailgun, add one TXT record at your sending domain containing `v=spf1 include:mailgun.org ~all`, then confirm it with `dig`. Mailgun's domain verification documentation gives that value as the SPF example. Only one SPF record may exist at a name, so if your domain already has one, merge the Mailgun include into it rather than adding a second.

    Research checked: 12 November 2026

    This guide covers the setup steps only. The cold-sending decisions and the troubleshooting table are in separate guides.

    The short answer

    1. In the Mailgun control panel, add your sending domain under Sending, then Domains.
    2. Open the domain's DNS records and copy the SPF value shown there, which the verification page gives as `v=spf1 include:mailgun.org ~all`.
    3. Create a TXT record at the name Mailgun shows (usually the domain or a subdomain you send from). Paste the value without surrounding quotes unless your DNS host requires them.
    4. Wait, then click Verify DNS settings in the domain's settings or wait for Mailgun's automatic check.

    Setup steps

    Step 1: Add the domain and read the record

    Mailgun's domain verification guide says to add the domain, then create the four records shown in the control panel: SPF (TXT), DKIM (TXT), tracking (CNAME) and receiving (MX). The SPF value is the one you need here. Use the name Mailgun displays for the record, because the verification page does not specify host fields.

    Choose the sending domain carefully. Your From address and the domain you verify should match, so that the SPF check and the visible sender line up. If you send from `mail.example.com`, put the record on that subdomain.

    Step 2: Merge with an existing SPF record

    If your domain already has an SPF record, for example one for Google Workspace, do not publish a second one. Combine the mechanisms in one record:

    ``` v=spf1 include:_spf.google.com include:mailgun.org ~all ```

    This example uses Google's include as a stand-in for any existing sender. Keep the `~all` or `-all` qualifier at the end only once.

    RFC 7208 states that multiple SPF records at the same name produce a `permerror`, and that SPF evaluation must limit DNS-querying mechanisms to 10. Each `include:` can add lookups of its own, so count them when you add another sender.

    Check the record and test

    Step 3: Understand the qualifier

    `~all` is a softfail. The RFC describes it as a weak statement that the host is probably not authorised, and it says receivers should not reject a message on that result alone. `-all` is a hard fail. Start with `~all` while you confirm every sender is listed. Move to `-all` only after you have checked all sending sources.

    Step 4: Verify the record

    Query the record from your own machine:

    ``` dig +short TXT mail.example.com ```

    The expected output is one line that contains `v=spf1` and `include:mailgun.org`. Quotes around the value are normal. If you see nothing, the record has not propagated or was created at the wrong name. Mailgun says DNS changes can take 24 to 48 hours to propagate.

    Then check the verification status in the Mailgun control panel. A verified domain shows a green Verified badge.

    Step 5: Send a test message

    Send one message from an address on the verified domain to a mailbox you control. Open the raw headers and look for `spf=pass` in `Authentication-Results`, with `smtp.mailfrom` on your sending domain. A pass here confirms the record works. It does not confirm the message reached the inbox.

    Frequently asked questions

    Keep reading

    Comparisons

    Instantly vs Smartlead: How to Choose a Cold Email Platform

    Instantly and Smartlead both support cold email campaigns across multiple sending accounts. The better choice depends on your contact limits, sending volume, reply workflow, and the cost of the features you actually need. Start

    Read
    Comparisons

    Instantly vs Smartlead Deliverability: How to Compare Inbox Placement

    Neither Instantly nor Smartlead can guarantee that a cold email reaches the inbox. Both provide tools for managing outreach, but inbox placement also depends on your sending domain, authentication, recipient list, message and the

    Read
    Comparisons

    Instantly vs Smartlead Pricing: Compare the Real Cost of Outreach

    The headline subscription is only one part of a cold email budget. The right comparison includes sending limits, contact storage, mailboxes, lead data, verification and any tools needed for your team. A cheaper entry plan can

    Read