Last updated: March 12, 2026
How to Set Up DMARC for Mailgun
Mailgun is a developer-focused email API service for sending, receiving, and tracking transactional emails. Domain verification in Mailgun involves adding SPF and DKIM records to ensure proper authentication and DMARC alignment for your sending domain.
This guide walks you through configuring SPF, DKIM, and DMARC for Mailgun so your emails are fully authenticated and your domain is protected from spoofing. Proper configuration ensures your messages reach the inbox and comply with the requirements of Gmail, Yahoo, and Microsoft Outlook.
SPF Configuration
SPF (Sender Policy Framework) authorizes Mailgun's mail servers to send email on behalf of your domain. Add the following include directive to your existing SPF record:
v=spf1 include:mailgun.org ~allIf you already have an SPF record with other include directives, add include:mailgun.org before the ~all or -all mechanism. For example:
v=spf1 include:_spf.google.com include:mailgun.org ~allImportant: You can only have one SPF record per domain. If you have multiple sending services, combine all include directives into a single record. SPF also has a 10 DNS lookup limit - exceeding this will cause SPF to fail. Use our SPF Checker to verify your record stays within limits.
DKIM Configuration
DKIM (DomainKeys Identified Mail) adds a cryptographic signature to your emails, proving they were not altered in transit. For Mailgun, the DKIM selector(s) used are: varies (provider-generated selector).
DKIM is configured by adding a TXT or CNAME record to your DNS at the selector subdomain (e.g., varies (provider-generated selector)._domainkey.yourdomain.com). The exact record value is generated by Mailgun in their admin console or dashboard. Follow the provider-specific steps below to generate and publish your DKIM record.
After adding the DKIM record, use our DKIM Checker to verify the record is published correctly and the signature can be validated.
DMARC Record
Once SPF and DKIM are configured for Mailgun, publish a DMARC record to tie everything together. Add the following TXT record at _dmarc.yourdomain.com:
v=DMARC1; p=none; rua=mailto:dmarc@yourdomain.com; fo=1Start with p=none to monitor authentication results without affecting mail delivery. The rua tag specifies where aggregate reports are sent, and fo=1 ensures you receive failure reports for any mechanism failure. After 2-4 weeks of monitoring, gradually move to p=quarantine and then p=reject for full protection.
v=DMARC1; p=reject; rua=mailto:dmarc@yourdomain.com; fo=1Step-by-Step Setup
Follow these Mailgun-specific steps to configure email authentication for your domain:
- Log in to the Mailgun dashboard at app.mailgun.com.
- Navigate to Sending > Domains and click 'Add New Domain'.
- Enter your sending domain (a subdomain like mail.yourdomain.com is recommended for isolation).
- Mailgun will display the required DNS records: a TXT record for SPF and a TXT record for DKIM.
- Add the SPF record or include 'include:mailgun.org' in your existing SPF record.
- Add the DKIM TXT record with the selector Mailgun provides (varies per domain).
- Optionally add the MX and CNAME tracking records if you want to receive email and track clicks.
- Click 'Verify DNS Settings' in the Mailgun dashboard to confirm all records are in place.
- Publish your DMARC record at _dmarc.yourdomain.com with p=none to begin monitoring.
Verify Your Setup
After completing the configuration, use our free tools to verify that SPF, DKIM, and DMARC are all correctly configured for your domain:
- DMARC Checker - Validate your DMARC record syntax, policy, and reporting configuration.
- SPF Checker - Verify your SPF record includes all authorized senders and stays within the 10 DNS lookup limit.
- DKIM Checker - Confirm your DKIM public key is published correctly and can validate signatures.
If any of these checks fail, review the steps above and ensure all DNS records have fully propagated. DNS changes can take up to 48 hours, though most propagate within a few hours.
Continuous Monitoring with Inbox Insignia
Setting up DMARC is just the beginning. Email authentication requires ongoing monitoring to catch configuration drift, new sending sources, and authentication failures before they impact deliverability. Inbox Insignia provides automated DMARC monitoring, aggregate report parsing, and compliance scoring for all your domains.
to start monitoring your Mailgun email authentication and receive alerts when your SPF, DKIM, or DMARC configuration needs attention.