Skip to main content

Configure Your Domain with Mailgun SPF and DKIM Records

Configure Your Domain with Mailgun SPF and DKIM Records to boost deliverability, prevent spoofing, and secure your emails.

Written by Syed Abuzar Mehdi
Updated over 8 months ago

Configuring your domain with Mailgun SPF and DKIM records is essential for improving email deliverability, protecting your domain from spoofing, and ensuring your messages reach recipients’ inboxes instead of spam folders.

SPF (Sender Policy Framework) verifies that Mailgun is authorized to send emails on behalf of your domain, while DKIM (DomainKeys Identified Mail) adds a cryptographic signature to prove the message’s authenticity.

In this guide, you’ll learn how to locate your Mailgun SPF and DKIM records, add them to your domain’s DNS settings, and verify their correct setup for reliable and secure email sending through Mailgun.


Table of Contents:


How to Configure Your Domain with Mailgun SPF and DKIM Records

To configure your domain for sending emails through Mailgun, it has to be verified by setting up the SPF and DKIM records to your domain provider’s DNS management section.

The DKIM or Domain Keys Identified Mail is an encryption authentication method that is used to ensure that the email is originated from an authorized system and it prevents spammers from stealing the identity of legitimate entities.

Whereas SPF or Sender Policy Framework is used to improve email reliability and prevent spoofing.

The SPF and DKIM DNS records allow Mailgun to deliver email for the domain.

Steps to Configure Your Domain with Mailgun SPF and DKIM Records

Step #1 - Find the SPF and DKIM records on Mailgun Account:

Once you have added your domain to your Mailgun account, you’ll find the SPF and DKIM DNS records when you click on your added domain under the Domains tab in the Mailgun control panel.

The two TXT records for SPF and DKIM are listed under the Sending section.

Step #2 - Add the SPF and DKIM as TXT Record:

The next step is to go to your domain provider dashboard and find the DNS Management section.

There you will need to select record type TXT from the list to add SPF and DKIM records.

For SPF TXT record under Name/Host, type: @

and for Value, put: v=spf1 include:mailgun.org ~all

For DKIM TXT record under Name/Host use:<prefix>._domainkey

For Value use: copy/paste the DKIM from the Mailgun control panel as shown in Step #1.

Step #3 - Check the SPF and DKIM using Online Tool:

Once the SPF and DKIM TXT records for Mailgun are added at the domain registrar DNS, propagation will take some time.

To check whether SPF and DKIM records have been set correctly at the domain provider and propagated fully, any records checker such as the mail tester’s tool can be used.


That’s it! We hope this article was helpful.

Need Help?

If you need assistance, feel free to:

We're here 24/7 to help you!

Did this answer your question?