How to Set Up DMARC for Mailgun

Publish a DMARC record to protect your domain when sending transactional email through Mailgun.

Quick Answer — The Record You Need

Record Type

TXT

Host / Name

_dmarc

Value
v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1

If using a Mailgun subdomain, add the DMARC record to that subdomain: _dmarc.mg.yourdomain.com.

Step-by-Step Setup

1

Verify SPF and DKIM are configured

Ensure both SPF and DKIM are set up and verified in Mailgun for your sending domain.

2

Send a test email

Use Mailgun's API or SMTP to send a test message and check the Authentication-Results header for SPF and DKIM pass.

3

Create the DMARC record

Add a TXT record at _dmarc.yourdomain.com (or _dmarc.mg.yourdomain.com if using a subdomain).

v=DMARC1; p=none; rua=mailto:[email protected]; ruf=mailto:[email protected]; fo=1
4

Monitor and analyze

Review DMARC reports for 2-4 weeks to ensure Mailgun emails pass alignment.

5

Move to enforcement

Gradually move to p=quarantine and then p=reject.

Common Gotchas

  • If Mailgun sends from a subdomain (mg.yourdomain.com), you need a DMARC record on that subdomain. The parent domain DMARC record applies to subdomains only if no subdomain-specific record exists.
  • Mailgun emails align DKIM on the sending domain. Ensure your DKIM record is on the same domain or subdomain you use as the From address.
  • The sp= tag in a parent domain DMARC record controls subdomain policy. If you want different policies for your root domain and Mailgun subdomain, use separate DMARC records.

Verify Your Setup

After adding your DNS records, use our free DMARC checker to verify everything is configured correctly. DNS changes typically propagate within minutes, but can take up to 48 hours.

Frequently Asked Questions

Do I need DMARC on my Mailgun subdomain?

If your root domain has a DMARC record, it applies to subdomains via the sp= tag (or defaults to the p= policy). You can add a separate DMARC record on the subdomain for a different policy.

Will DMARC affect Mailgun deliverability?

Proper DMARC improves deliverability by signaling to receivers that you actively protect your domain. It only blocks email if authentication fails.

How do I test DMARC alignment with Mailgun?

Send a test email via Mailgun, then inspect the email headers. Look for Authentication-Results showing dmarc=pass and verify the alignment mode (relaxed or strict).

Related Guides