All Collections
DNS records
How to generate DKIM for Mailgun
How to generate DKIM for Mailgun
Maksym Olkhovskyi avatar
Written by Maksym Olkhovskyi
Updated over a week ago

What is DKIM, and how does it work?

Reputable email servers block fake senders to prevent scams. DKIM provides strong security by digitally signing emails and storing keys in DNS. Customize DKIM for smoother email delivery. It works behind the scenes, securing server-to-server communication. The sending server signs the email, and the receiving server checks it with a public key, maintaining email integrity.

How to set up DKIM with Mailgun

Mailgun enforces a verified DKIM key through a DNS check before allowing a domain to send emails from its platform. This approach enhances the security of your messages by enabling you to tailor your DKIM key to your domain's unique requirements, aligning it with your organization's identity. This makes your emails easily identifiable to recipients and grants you control over your DKIM records, allowing adjustments for you and your team.

Here's a detailed guide outlining step-by-step instructions on how to personalize your DKIM setup with Mailgun:

You can add a domain you own and verify by setting up the DNS record we provide (the DKIM record) at your DNS provider. An example is below.

1. To include your domain or subdomain, add it in the "Domains" section of the Mailgun control panel or integrate it via the API.

2. Selecting the length of your DKIM key is an important decision. Longer keys provide increased protection against spammers and enhance security.

3. Add your records. Open your DNS provider and add the DKIM TXT DNS record provided. This record can be found in the Domain Verification & DNS section of the domain settings page of the Mailgun control panel.

4. If you want Mailgun to track clicks and opens, add the CNAME record.

5. MX records should also be added unless you already have MX records for your domain pointed at another email service provider (e.g., Gmail).

After adding the records and allowing them to propagate, your domain will undergo the verification process. Please remember that verifying DNS changes may take 24-48 hours

How can I make sure everything's working right?

If you want to make sure that everything is correctly verified, you can contact your CSM or email us at Our technicians will check your DNS records. We will be glad to help you.

Did this answer your question?