Patchkit

Setup guide

Mailgun: SPF, DKIM and DMARC

Mailgun usually runs on a subdomain such as mg.yourdomain.com, with its own SPF include and a DKIM TXT record.

DNS records to add

TXTHost<mg>
v=spf1 include:mailgun.org ~all

SPF for the sending subdomain (use eu.mailgun.org for the EU region)

TXTHost<selector>._domainkey.<mg>
<DKIM value from Mailgun → Sending → Domains → DNS records>Get this value from your provider's dashboard.

DKIM signing key

MXHost<mg>
10 mxa.mailgun.org

Receiving and bounce handling (optional)

Steps

  1. In Mailgun open Sending → Domains → your domain → DNS records.
  2. Publish the SPF and DKIM TXT records, and the MX records if you want Mailgun to receive mail.
  3. Click Verify DNS settings.

Good to know

  • Match the region: EU accounts use eu.mailgun.org in SPF and mxa.eu.mailgun.org for MX.

Adding records at your DNS host

Cloudflare · Namecheap · GoDaddy · Amazon Route 53

Check your setup

After publishing, run the domain health check. DNS changes usually appear within minutes, but can take up to a few hours. Official reference: Mailgun documentation.