MailGun DKIM and SPF Setup: Step by Step

Mailgun is one of the leading email delivery services for businesses worldwide. It’s an API-based email delivery service for sending, receiving, and tracking emails. The app was founded in 2010. For the last decade, it has provided powerful APIs that enable you to send, receive and track email effortlessly whether you use Python, Ruby, PHP, C#, Node.js, or Java. This authentication guide will cover the Mailgun DKIM and SPF setup.

Setting up DKIM

Step 1: Head to your Mailgun portal.

Step 2: On the left of the screen, click on the collapsible “Sending” tab and choose “Domains.”

Step 3: From there, add a subdomain.

N.B: Subdomain is important, so the MX provided by Mailgun doesn’t interfere with your root domain’s MX records.

Add domain from "Sending" tab's "Domains" section

Step 4: Mailgun will provide you with a couple of records that you’ll need to add to your DNS zone.

Provided Mailgun records to be added to the DNS

Step 5: Copy all the records and add them to your DNS zone.

Step 6: Wait a couple of minutes and click “Verify DNS settings.”

Adding SPF to Mailgun

Adding DKIM to Mailgun

Adding MX to Mailgun

Adding CNAME for tracking

Note: Turn off the proxy status if you’re using Cloudflare.

Step 8: Mailgun will validate the records for the added subdomain with a green checkmark.

Mailgun Verified badge for the subdomain

Now, your Mailgun DKIM and SPF setup is complete. Now you can send DMARC compliant emails with Mailgun. (Make sure you have your aspf and adkim set to “relaxed” instead of “strict” in your DMARC record.) More about DMARC tags here.

DMARK and SPF setup pass and aligned

Note: Wait at least 24 hours to receive the updated reports.

If you have any further questions, don’t hesitate to contact the EasyDMARC support team via the form on our website or at [email protected]

Email Security as a Service

Email Security as a Service

Email security is one of the most important aspects of any business. Why? Because email...

Read More
What’s the Difference Between SPF DKIM and DMARC?

What’s the Difference Between SPF DKIM and DMARC?

SPF, DKIM, and DMARC are the three most important email authentication protocols to prove...

Read More
How to Stop Spam Emails and Save Your Inbox [Corporate Email Edition]

How to Stop Spam Emails and Save Your Inbox [Corporate Email Edition]

Everyone agrees that email is fast becoming the preferred communication channel for businesses and...

Read More