Mailgun is a favorite among developers and product teams for reliable transactional email delivery. However, setting up Mailgun requires adding include:mailgun.org to your SPF record. For many companies, this specific instruction is the trigger that pushes their DNS record over the global 10-lookup limit.

The 10-lookup limit is a hardcoded constraint in how email authentication works. If your SPF record requires more than 10 lookups, receiving mail servers (like Google, Yahoo, and Microsoft) throw a PermError. This means your emails are rejected or sent to spam because your domain appears improperly authenticated.

Why Mailgun SPF Bloat Happens

Mailgun manages a massive, distributed infrastructure to ensure high deliverability, which means their own SPF record resolves to several sub-domains and IP clusters. When you add their include to your existing list—which likely already includes your workspace provider and other SaaS tools—you run out of your 10-lookup budget very quickly.

The Danger of "Quick Fixes"

You might be tempted to resolve Mailgun's hostnames into static IP addresses and hardcode them into your DNS. Avoid this at all costs. As Mailgun scales their network, they rotate their IP addresses. If you have hardcoded IPs, your record becomes obsolete the moment they update their infrastructure, and your transactional emails will stop delivering without warning.

The Professional Mailgun Fix

The only sustainable way to handle Mailgun alongside your other tools is through automated SPF flattening.

At SPF1, our engine takes your Mailgun include—along with the rest of your tech stack—and resolves them into a clean, single-lookup record. We constantly monitor Mailgun's infrastructure and automatically update your flattened record whenever their IPs change. You stay perfectly compliant and under the lookup limit, ensuring your transactional emails reach the inbox every time.