For Mailgun, add and verify a sending domain (usually a subdomain like mg.yourdomain.com), then publish the SPF TXT (v=spf1 include:mailgun.org ~all) and the DKIM TXT record Mailgun generates. Using your own domain for DKIM is what aligns Mailgun mail with DMARC.
Mailgun provides SPF, DKIM and tracking records for your sending domain. Publish them and verify in the Mailgun dashboard.
Because DKIM is signed with your domain (or sending subdomain), DMARC passes on DKIM alignment. Confirm in your aggregate reports before enforcing.
Check the selector:
$ dig TXT smtp._domainkey.mg.yourdomain.com +shortCheck your SPF record now
Open the free SPF checker →Yes — a dedicated sending subdomain is Mailgun’s recommended setup and keeps your main domain’s reputation separate while staying DMARC-aligned.