Guides › Transactional

Mailgun SPF record & DKIM setup

The exact SPF include for Mailgun, how many of your 10 DNS lookups it costs right now, and how to turn on DKIM so you pass DMARC.

SPF

If Mailgun is your only sender, publish this TXT record at your root domain (@):
v=spf1 include:mailgun.org ~all

Already have an SPF record? Don't add a second one. Add include:mailgun.org before the ~all, or use the SPF merger.

Live lookup cost: 5 lookups

Current record at mailgun.org:

v=spf1 include:_spf.mailgun.org include:_spf.eu.mailgun.org -all

Measured live from DNS and refreshed daily. Mailgun can change this at any time, which is exactly why monitoring matters.

DKIM

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

DMARC

SPF and DKIM only protect you once DMARC ties them to your visible From: address. If you don't have one yet, start with:

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

Official documentation: Mailgun docs

Using Mailgun with another service?

Check that Mailgun is set up correctly on your domain