Make Mailgun pass DMARC

How to make email sent through Mailgun pass DMARC: set up DKIM for your domain, align SPF, and confirm it works.

Why it fails

DMARC passes when a message has a DKIM signature for your domain, or passes SPF for your domain. Until you set up domain authentication, Mailgun signs your messages with its own domain (mailgun.org and mailgun.net) and uses its own bounce address (mailgun.org and mailgun.net). DKIM and SPF may pass, but for Mailgun’s domain rather than yours, so they do not align with your From address and DMARC fails.

Step 1: Set up DKIM for your domain

Set up domain authentication for your sending domain in Mailgun. It gives you DNS records to publish, usually CNAME or TXT records, and checks that they are in place. From then on Mailgun signs your mail with your own domain, and a DKIM signature for your domain is enough on its own for DMARC to pass.

Read Mailgun’s DKIM instructions

Step 2: SPF

This step is optional once DKIM is set up, but gives you a second way to pass. SPF only counts for DMARC when the envelope sender (the return-path, where bounces go) is on your domain. By default Mailgun uses its own.

Only add include:mailgun.org to your SPF record if Mailgun’s instructions ask for it. On its own, an include on your main domain does not make SPF align, and each include uses up some of SPF’s 10 DNS lookups.

Step 3: Confirm it works

DNS changes can take from a few minutes to a day to be visible everywhere. Once the records are published, use the domain checker to confirm your DMARC and SPF records are valid. It looks for DKIM keys at common selectors; if you know the selector names Mailgun gave you, add them under “DKIM selectors”.

The real test is your DMARC reports. Within a day or two of the change, mail from Mailgun should show an aligned DKIM pass. With a free DMARC Owl account, Mailgun moves from Needs fixing to Healthy on your dashboard, and you can see the change day by day.

How we recognise Mailgun in reports

These are the domains DMARC Owl uses to identify Mailgun as the sender in your reports.

DKIM signing domains
  • mailgun.org
  • mailgun.net
Envelope (bounce) domains
  • mailgun.org
  • mailgun.net
SPF includes
  • mailgun.org
  • eu.mailgun.org

Mailgun may change its setup steps over time; its own documentation is the authority. Website: www.mailgun.com