100% Client-Side EngineZero data storage • No email signup required • 2026 Google & Yahoo Bulk Sender Compliant
Transactional Email API 2026 Google & Yahoo Compliant

Mailgun SPF & DMARC Setup Guide

Mailgun is designed for developers sending transactional and marketing emails. Mailgun strongly recommends configuring a sending subdomain (e.g. mg.yourdomain.com) to separate marketing reputation from primary company email.

Transactional Email APIRFC 7208 & RFC 7489 Validated

Mailgun DNS Preset Generator

Enter your domain below to customize the exact SPF and DMARC TXT records required for Mailgun.

RFC 7208 DNS Lookup Cost1 of 10 Lookups

1 direct Mailgun SPF relay query. If configuring Mailgun on a subdomain (mg.yourdomain.com), create the SPF record on the subdomain host rather than the apex.

Lookup Budget1/10
RECORD 1: SPFHost: @ (or apex domain)Type: TXT
v=spf1 include:mailgun.org ~all

⚠️ Important: If your domain already publishes an existing SPF record, merge include:mailgun.org into that record. Never publish two separate SPF records.

RECORD 2: DMARCHost: _dmarc (or _dmarc.example.com)Type: TXT
v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@example.com; pct=100; adkim=r; aspf=r

This policy enforces p=quarantine (suspicious emails routed to spam) and directs daily XML compliance reports to dmarc-reports@example.com.

Live DNS Propagation Check for example.com

Query Cloudflare DNS-over-HTTPS in real-time to check if your domain already publishes valid records.

Using Mailgun alongside other platforms?Open Multi-Provider SPF Merger & Lookup Calculator
Step-by-Step Instructions

How to configure Mailgun in your DNS

Follow these 4 straightforward steps to publish your authentication records on Cloudflare, GoDaddy, Namecheap, or AWS Route 53.

1

Add Domain in Mailgun Dashboard

Add your sending domain or subdomain (e.g., mg.yourdomain.com) inside the Mailgun control panel.

2

Add Mailgun SPF Record

Create a TXT record with include:mailgun.org on your chosen sending host.

v=spf1 include:mailgun.org ~all
3

Publish Mailgun DKIM Key

Publish the 2048-bit DKIM TXT record (Host: k1._domainkey) provided by Mailgun.

4

Publish DMARC Policy

Ensure a DMARC policy is published on your root domain (@) to cover all subdomains.

v=DMARC1; p=quarantine; rua=mailto:dmarc-reports@yourdomain.com; pct=100
Technical Q&A

Frequently Asked Questions for Mailgun

Technical answers regarding lookup limits, multiple records, and delivery errors.

Why does Mailgun suggest using a subdomain like mg.yourdomain.com?▼
Using a dedicated subdomain protects your primary corporate email reputation. If cold marketing campaigns encounter bounces or complaints, your day-to-day Google Workspace or Office 365 inbox is never affected.
Does Mailgun SPF include require a MX record?▼
Yes, Mailgun uses two MX records (mxa.mailgun.org and mxb.mailgun.org) if you intend to receive incoming email and process bounce webhooks.

Common Providers Used with Mailgun

Send marketing and transactional emails alongside your corporate inbox.

View All 50+ Guides
Full Email Deliverability Suite

Need to combine multiple providers into one SPF record?

Our full in-browser engine merges SPF records, calculates RFC 7208 lookups in real-time, and generates custom DMARC policies.