SPF, DKIM and DMARC for Mailgun
Verify a Mailgun sending domain so app mail passes DMARC: the SPF record, the DKIM record, the tracking CNAME and the MX records, on a sending subdomain such as mg.
Mailgun
app and transactional mail
SPF
aligns after setup: include:mailgun.org on the sending subdomain, which aligns with the domain
DKIM
aligns after setup: the DKIM record from the domain's DNS settings in Mailgun
DMARC pass
one aligned pass is enough
- TXT
mgv=spf1 include:mailgun.org ~all - TXT
<selector>._domainkey.mg<the value Mailgun shows>Or two CNAME records, with Automatic Sender Security. - CNAME
email.mgmailgun.orgClick and open tracking. - MX
mg10 mxa.mailgun.org and 10 mxb.mailgun.orgOnly if Mailgun should receive mail at the subdomain.
1Add a sending subdomain
In Mailgun add a domain such as mg.<domain> rather than the domain itself, so its MX and SPF never touch the domain's own mail.
2Publish the records
Copy the records from the domain's DNS settings in Mailgun: SPF, DKIM, the tracking CNAME, and the MX records if Mailgun should receive mail.
3Verify
Press Verify DNS settings, or wait for Mailgun to check. DNS can take 24 to 48 hours.
4Publish a DMARC record
At _dmarc.<your domain>, a TXT record starting at p=none with a report address, so you can see this service's mail pass before you enforce. The DMARC generator writes one.
The free tools
Set up once. Watched every day.
DNS says what a domain asks receivers to do. Only the reports receivers send say what happened to its mail. DMARC Harbor reads those reports for every client domain, every day, names each service sending as it, and says when it is safe to move to p=reject.