---
title: Mailgun - SPF & DKIM Configuration
description: Configure SPF and DKIM with Mailgun effortlessly. Follow our step-by-step guide to ensure reliable email delivery and enhance your domain's security.
---

[Skip to content](https://support.warmy.io/knowledge/mailgun-spf-dkim-configuration#main-content)

English

Show submenu for translations

![Group 1261151152.png\]](https://support.warmy.io/hs-fs/hubfs/Group%201261151152.png?width=50&height=50&name=Group%201261151152.png)

Open main navigation

Close main navigation

- English
  
  Show submenu for translations
- [Go to warmy.io](https://www.warmy.io/)

[Go to warmy.io](https://www.warmy.io/)

 Hey there Warmer! How can we help? 🙏

- There are no suggestions because the search field is empty.

1. [Help Center](https://support.warmy.io/knowledge?hsLang=en)
2. [Technical questions](https://support.warmy.io/knowledge/technical-questions?hsLang=en)
3. [SPF and DKIM Configuration](https://support.warmy.io/knowledge/technical-questions?hsLang=en#spf-and-dkim-configuration)

# Mailgun - SPF & DKIM Configuration

## Learn how to configure SPF and DKIM records for Mailgun to authenticate your sending domain, improve deliverability, and prevent spoofing.

![](https://support.warmy.io/hs-fs/hubfs/1-png.png?width=670&height=335&name=1-png.png)

 ![](https://a.slack-edge.com/production-standard-emoji-assets/16.0/google-medium/1f3a7.png) Prefer to listen? Hit play to hear this article read aloud.

   

### **How to configure SPF and DKIM records in Mailgun?**

**Supported Authentication Methods  
✅ SPF:** Supported  
✅ **DKIM:** Supported

**First**, Log in to your Mailgun account.

![](https://support.warmy.io/hs-fs/hubfs/1-png-3.png?width=670&height=447&name=1-png-3.png)

From the left navigation menu, click in **Sending** → **Domains**. This is where you'll manage the domain used for sending emails.

![](https://support.warmy.io/hs-fs/hubfs/2-png.png?width=670&height=431&name=2-png.png)  
Add a subdomain to your account. When adding the domain, select a **2048-bit DKIM key length**, as this is the recommended and most secure option.

**Important:** Always use a subdomain, not your root domain. Using a subdomain prevents **Mailgun's MX records** from conflicting with the **MX records** already configured on your primary domain.

![](https://support.warmy.io/hs-fs/hubfs/3-png.png?width=670&height=412&name=3-png.png)

---

### **Mailgun – SPF Record Configuration**

After adding your subdomain, **Mailgun** will generate an **SPF** record.

1\. Copy the **SPF** record provided by Mailgun.  
2\. Open your **DNS** provider.  
3\. Add the **SPF** record to the subdomain you created.

**![](https://support.warmy.io/hs-fs/hubfs/4-png-2.png?width=670&height=377&name=4-png-2.png)**

The example below shows how the record appears in **Cloudflare**.

**![](https://support.warmy.io/hs-fs/hubfs/5-png-3.png?width=670&height=377&name=5-png-3.png)**

---

### **Mailgun – DKIM Record Configuration**

**Next**, configure your **DKIM** record.

1\. Copy the **DKIM** record generated by **Mailgun**.  
2\. Publish it in your **DNS** zone using your **DNS** provider.

The example below shows how the record appears in **Cloudflare**. 

**![](https://support.warmy.io/hs-fs/hubfs/6-png.png?width=670&height=365&name=6-png.png)**

---

### **Configure the Additional DNS Records**

In addition to **SPF** and **DKIM**, Mailgun requires a few extra **DNS** records to function correctly.

These include:  
**a) MX records:**  Required for email routing.  
**b) Tracking CNAME record:** Enables email open and click tracking.

![](https://support.warmy.io/hs-fs/hubfs/7-png.png?width=670&height=284&name=7-png.png)

Tracking record:

**![](https://support.warmy.io/hs-fs/hubfs/8-png.png?width=670&height=234&name=8-png.png)**

Add the Tracking **CNAME** record to your **DNS** configuration. The example below shows how it should look in **Cloudflare**.

**![](https://support.warmy.io/hs-fs/hubfs/9-png.png?width=670&height=312&name=9-png.png)**

---

### **Enable DMARC Reporting**

Mailgun now supports **DMARC** reporting. To enable it, add **Mailgun's RUA** and **RUF** email addresses to your existing **DMARC** record, if you already have one for that subdomain.

Do not create a second **DMARC** record; each domain should have only one. Simply update the existing record with **Mailgun's addresses**.

**![](https://support.warmy.io/hs-fs/hubfs/10-png.png?width=670&height=271&name=10-png.png)**

---

### **Verify Your DNS Records**

Once all **DNS** records have been added, wait for **DNS** propagation.

When **Mailgun** detects the records successfully, each one will display a Verified status next to each record, confirming everything is active.

You can also click **Check Status** button at any time to verify whether your **DNS** records have been detected.

![](https://support.warmy.io/hs-fs/hubfs/11-png.png?width=670&height=339&name=11-png.png)

---

### **Configuration Complete**

Your **Mailgun SPF** and **DKIM** setup is now complete, and you're ready to send **DMARC**-compliant emails. Make sure your **DMARC** record has both **aspf** and **adkim** set to relaxed (rather than strict) for best compatibility.

#### [Need help? **Schedule a call with us**](https://www.warmy.io/book-a-support-call)

- [Connection Guide](https://support.warmy.io/knowledge/connection-guide?hsLang=en)
- [General questions](https://support.warmy.io/knowledge/general-questions?hsLang=en)
- [Technical questions](https://support.warmy.io/knowledge/technical-questions?hsLang=en#main-content)

    - [SPF and DKIM Configuration](https://support.warmy.io/knowledge/technical-questions?hsLang=en#spf-and-dkim-configuration)
- [Subscription](https://support.warmy.io/knowledge/subscription?hsLang=en)
- [Collaborate](https://support.warmy.io/knowledge/collaborate?hsLang=en)
- [Features](https://support.warmy.io/knowledge/features?hsLang=en)
- [Troubleshooting](https://support.warmy.io/knowledge/troubleshooting?hsLang=en#main-content)

    - [SMTP Errors](https://support.warmy.io/knowledge/troubleshooting?hsLang=en#smtp-errors)
    - [Service-related issues](https://support.warmy.io/knowledge/troubleshooting?hsLang=en#service-related-issues)
- [Integrations](https://support.warmy.io/knowledge/integrations?hsLang=en#main-content)

    - [Seed List Automations](https://support.warmy.io/knowledge/integrations?hsLang=en#seed-list-automations)

[![Chill listening crop-3](https://support.warmy.io/hs-fs/hubfs/Group%201261151152.png?width=24&height=24&name=Group%201261151152.png "Chill listening crop-3")](https://www.warmy.io/)

warmy.io Help Center

<https://www.linkedin.com/company/warmy> <https://www.youtube.com/channel/UCZu6E6YFPAssti54Ks2CV7A> <https://www.facebook.com/warmy.io> <https://www.instagram.com/warmy.io/?hl=en> <https://www.tiktok.com/@warmy_io>

Copyright © 2026, AnyBiz LTD