76.9% of conveyancers can be impersonated. [Read]

Mailgun

Verify your sending domain and publish its DKIM record

4 min read DKIM Setup Guides

DKIM for Mailgun

Mailgun verifies each sending domain with DKIM and SPF records. Mailgun recommends sending from a subdomain such as mg.example.com.

Who does it

A Mailgun user with the Admin or Developer role, plus whoever manages your DNS.

Records

  • Automatic Sender Security (recommended): two CNAME records, pdk1._domainkey and pdk2._domainkey, pointing at Mailgun. Mailgun rotates the 2048-bit keys for you.
  • Without it: one TXT record at <selector>._domainkey with the key Mailgun generates (selectors vary, for example mx, pic or smtp).
  • An SPF TXT record on the sending domain, v=spf1 include:mailgun.org ~all.
  • MX records are optional and only for receiving mail through Mailgun. Adding them to a domain that already receives email elsewhere breaks your inbound mail.

Steps

  1. In Mailgun go to Sending › Domains › Add New Domain. Choose your region (US or EU). Under Advanced settings, choose Automatic Sender Security, or a 2048-bit key.
  2. Copy the records from Sending › Domain settings › DNS records to your DNS host.
  3. Click Check status. It is usually verified within minutes, sometimes up to 48 hours.
  4. Already using Mailgun with a TXT key? On the DNS records page choose Actions › Turn on automatic sender security; Mailgun keeps signing with the old key until the new CNAMEs verify.

If you send from your main domain rather than a subdomain: If DMARC Busta manages your SPF record, don't edit SPF at your DNS host: with Autopilot on, the platform is added to your SPF once it shows up in your reports; otherwise it appears as a recommended source on the domain's SPF page for you to approve. Editing the record directly is treated as drift.

If DKIM management is turned on for this domain in DMARC Busta, we host your _domainkey records. Add this record in DMARC Busta instead of at your DNS host: open the domain's DKIM tab, click Import External Key, choose the platform, and enter the selector and value it gives you.

Check it worked

The domain shows a green Verified badge. Send a test and look for dkim=pass with header.d= your domain. For DMARC, the signing domain must be your domain or a parent of it.

Pitfalls

  • Enter names like pdk1._domainkey.mg, not the full domain, if your DNS host adds it for you.
  • A 2048-bit TXT key is longer than 255 characters; some hosts need it split. CNAMEs avoid this.
  • A CNAME on a name blocks every other record on that same name.