Mailgun gives each domain a DKIM key at a name it generates — pic, krs, smtp, mailo or mx among them — as a TXT record. With Automatic Sender Security, released in September 2024, it uses two CNAMEs, pdk1 and pdk2, and rotates the keys itself.
| Whose | Mailgun — sending service |
| Selector | pdk1, pdk2 — or pic, krs, smtp, mailo, mx |
| Published as | A TXT with the key at a generated name (pic, krs, smtp, mailo, mx …); or, with Automatic Sender Security, two CNAMEs pdk1 and pdk2 into dkim1.mailgun.com |
| Key | 1024-bit by default in the dashboard, 2048 on request; 2048 with Automatic Sender Security |
| Rotation | Automatic Sender Security rotates every 120 days by default (at least 5); otherwise by hand, up to three keys per domain |
| Where to find it | Sending → Domain settings → DNS records |
| Can it go? | An old key once a new one is active and tested; deleting and re-adding a domain gives it a new selector and key. |
Is Mailgun’s key on your domain?
Enter a domain — or paste the DKIM-Signature header of a message it sent: we look for Mailgun’s key under pdk1 and pdk2 and pic and krs and smtp and mailo and mx, check it, and name every other key the domain publishes.
The records
With Automatic Sender Security — without it, one TXT at the name Mailgun shows:
pdk1._domainkey.example.com CNAME pdk1._domainkey.<id>.dkim1.mailgun.com
pdk2._domainkey.example.com CNAME pdk2._domainkey.<id>.dkim1.mailgun.com
How it works
Mailgun does not say how it picks the generated name; a selector can also be set through its API. Mailgun recommends rotating at least every six months.
Common mistakes
- A 2048-bit TXT key is longer than 255 characters and must be split into strings at hosts that do not do it themselves.
- A DNS host that appends the domain to the name.
What changed
- 10 September 2024 — Automatic Sender Security: 2048-bit keys behind pdk1 and pdk2 CNAMEs, rotated for you.
Setting up Mailgun from scratch? Its SPF, DKIM and DMARC records, and a check of all three.
Questions
Why is my Mailgun selector krs when my colleague’s is pic?
Mailgun generates the name per domain; the one in your dashboard is the one to publish. With Automatic Sender Security every domain uses pdk1 and pdk2.
Sources
Checked on 27 September 2026 against these official sources:
- Mailgun DKIM Security — documentation.mailgun.com
- How can I rotate my DKIM key — help.mailgun.com
- Cloudflare DNS Setup Guide — help.mailgun.com
- DKIM Automatic Sender Security — mailgun.com