DKIM Setup for Mailgun
January 16, 2026 • InboxGreenEmail Team
🚨 DKIM issues can silently kill replies.
If opens dropped, replies disappeared, or bounces increased, treat it as an incident. Run the scan and get a fix path.
No signup required. Works on any domain.
DKIM Setup for Mailgun
Setting up DKIM for your Mailgun account can feel daunting, especially if you are not familiar with email authentication. However, getting this right is crucial for your email deliverability and domain reputation. Without DKIM, your emails are more likely to end up in the spam folder or get bounced altogether. This becomes urgent when you start seeing warning messages in Gmail or if your emails are consistently not reaching your recipients. If you want your emails to land in the inbox, you need to ensure that DKIM is properly configured.
At a glance
- This problem affects SaaS founders, marketers, and technical teams managing email sending.
- This article will guide you through the DKIM setup process for Mailgun.
- Following these steps will help improve your inbox placement and domain reputation.
When this problem shows up in real life
DKIM issues can manifest in various ways. Here are a couple of real world examples:
- Error Message: You may see a bounce message stating, "Message rejected due to DKIM signature failure." This indicates that the receiving server could not verify the DKIM signature.
- Gmail Header Analysis: If you analyze the headers of an email sent from your Mailgun account, you might see something like this:
Authentication-Results: mx.google.com; dkim=fail (bad signature) [email protected] ... Step by step: DKIM setup for Mailgun
- Log into your Mailgun account.
Start by accessing your Mailgun dashboard. You will need to navigate to the domain settings for the domain you are sending emails from.
- Locate the DKIM settings.
In the domain settings, find the section for DKIM. Mailgun usually provides a DKIM key that you will need to add to your DNS records.
- Add the DKIM record to your DNS.
You will need to create a new TXT record in your DNS settings. Here’s how to do it:
- Go to your DNS provider's dashboard.
- Find the section for DNS records.
- Add a new TXT record with the following details:
Host: mailgun._domainkey.yourdomain.com Value: v=DKIM1; k=rsa; p=YOUR_PUBLIC_KEYReplace "YOUR_PUBLIC_KEY" with the actual key provided by Mailgun.
- Verify the DKIM setup.
Once you have added the DKIM record, use a tool like the InboxGreen checker to verify that the DKIM is set up correctly. This step is crucial to ensure that everything is working as intended.
Common mistakes
- Symptom: DKIM signature fails on delivery.
Cause: The public key in the DNS record is incorrect.
Fix: Double-check the DKIM record in your DNS settings and ensure it matches exactly what Mailgun provided. - Symptom: Emails still landing in spam.
Cause: DKIM record is not propagated yet.
Fix: Wait for DNS propagation, which can take up to 48 hours. Use a DNS lookup tool to check if the record is visible. - Symptom: DKIM record appears correct, but emails are still bouncing.
Cause: Other authentication issues like SPF or DMARC misconfigurations.
Fix: Review your SPF and DMARC settings to ensure they are correctly configured. - Symptom: DKIM verification fails only for specific recipients.
Cause: The recipient's email server may not support DKIM or may have strict policies.
Fix: Analyze the headers of the bounced emails for more details and consider contacting the recipient's email service for clarification.
Troubleshooting when it still fails
- Symptom: DKIM appears correctly set up but emails are still not delivering.
Likely cause: Check the Authentication-Results headers.
What to try next: Look for any additional errors in the headers that might indicate other issues. - Symptom: DKIM record is not found.
Likely cause: DNS caching issues or incorrect record setup.
What to try next: Use a DNS TXT lookup tool to confirm the record is set up correctly. - Symptom: DKIM signature is valid, but emails still go to spam.
Likely cause: Poor domain reputation or user engagement.
What to try next: Check your domain reputation and consider cleaning your email list.
Related checks you should run
- Ensure SPF and DKIM alignment for better deliverability.
- Check DNS TTL settings and propagation delays.
- Monitor your domain reputation to avoid being flagged as spam.
- Review list quality and engagement patterns to maintain a healthy sender score.
FAQ
Why is DKIM still failing on Mailgun after I added the record?
If DKIM is still failing, check if the DNS record has propagated correctly. Use a DNS lookup tool to verify that the DKIM record is visible. If it is, ensure that the public key matches what Mailgun provided.
How long do DNS changes take to apply on Mailgun?
DNS changes can take anywhere from a few minutes to 48 hours to propagate, depending on your DNS provider. If you do not see changes immediately, be patient and check again later.
Can I use more than one DKIM key with Mailgun?
Mailgun allows you to set up multiple domains, each with its own DKIM key. However, you cannot use multiple DKIM keys for the same domain simultaneously. Each domain should have one unique DKIM record.
What if my DKIM record is valid but emails still go to spam?
Even with a valid DKIM record, factors like poor domain reputation, lack of engagement, or other authentication issues can cause emails to land in spam. Review your sending practices and consider using tools to analyze your domain reputation.
What to do next
Now that you have your DKIM set up for Mailgun, it is essential to monitor its effectiveness. Use the InboxGreen checker to verify your email authentication regularly. Additionally, consider running checks on your SPF and DMARC settings to ensure everything is aligned. Keeping your email sending practices clean will help maintain your domain's reputation and improve inbox placement.
Free Deliverability Scan
Check SPF, DKIM, DMARC and List-Unsubscribe for your domain in seconds.