DKIM setup for Mailgun
Updated 2026-11-18. Lookup counts measured live from public DNS on that date.
DKIM proves an email really came from your domain. For Mailgun the record type is TXT and the host is k1._domainkey, mx._domainkey, pic._domainkey. The value is unique to your account, so copy it from the dashboard.
Steps
Mailgun > Sending > Domains > your sending domain > DNS records: publish the TXT DKIM record (selector shown, often k1 or pic) and the SPF TXT on the sending (sub)domain > Verify DNS settings.
Official Mailgun DKIM documentation
Common mistakes
- Pasting the full hostname into a DNS panel that appends the domain automatically (you end up with
k1._domainkey.yourdomain.com.yourdomain.com). - Publishing the record but never clicking "verify" or "start authentication" in Mailgun.
- Using a 1024-bit key or smaller when 2048-bit is available (Yahoo requires at least 1024).
- Proxying the CNAME through Cloudflare (orange cloud). DKIM CNAMEs must be "DNS only".
Check your own domain in 5 seconds
Free SPF, DKIM and DMARC check. If something is broken, get the exact records for your setup (€29 one-time).
FAQ
Does Mailgun sign with my domain by default?
Not until you complete domain authentication. Until then mail is signed with Mailgun's own domain, which does not align with your From address for DMARC.
How do I check DKIM is working?
Send yourself an email at Gmail > Show original. Look for DKIM: PASS with d=yourdomain.com.
Do I still need SPF and DMARC?
Yes. Gmail, Yahoo, Microsoft and Spamhaus expect SPF, DKIM and a DMARC record together.