Skip to content
Email

Mailgun Setup - Namecheap Domain Setup

EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records…

6 min read1,242 words27 explained imagesUpdated Wed, 1 Jul at 6:53 AM
View as markdownOpen in ClaudeOpen in ChatGPT
Each image has a one line explanation. Switch to full detail for the step it belongs to, the fields and buttons involved, examples and the whole procedure.
On this page
  1. Sign Up for Mailgun
  2. Verify Your Email Address
  3. Add a New Domain in Mailgun
  4. Choose a Main Domain or Subdomain
  5. Add Your DNS Records in Namecheap
  6. Get Your API Key & Send a Test Email
  7. Frequently Asked Questions
EMAIL INFRASTRUCTURE
Step-by-Step Mailgun Setup: Namecheap Domain Setup
Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver.
What You'll Learn

This guide covers creating a Mailgun account, adding a sending domain, choosing between a main domain and a subdomain, and publishing the 5 required DNS records — 2 TXT, 2 MX, and 1 CNAME — inside Namecheap's Advanced DNS settings.

1Sign Up for Mailgun

Create your account at Mailgun.com.

2Verify Your Email Address

Check your email inbox to verify the email address you signed up with.

Verify Your Email Address (image 1 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Verify Your Email Address" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Verify Your Email Address" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 1 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
Verify Your Email Address (image 2 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Verify Your Email Address" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Verify Your Email Address" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 2 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

3Add a New Domain in Mailgun

Log in to Mailgun and click Sending → Add New Domain.

Add a New Domain in Mailgun (image 3 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add a New Domain in Mailgun" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add a New Domain in Mailgun" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 3 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

4Choose a Main Domain or Subdomain

If your domain is companyname.com, you can set up either the main domain or a subdomain with Mailgun.

Option A
Main Domain

If you add the main domain, it should not be used with Google Workspace or any other email provider.

Option B
Subdomain

To set up a subdomain with Mailgun, you can type anything_here.companyname.com. Examples:

  • mg.companyname.com
  • replies.companyname.com
  • support.companyname.com
Note

Set up the domain or subdomain under the US region, not EU. Then click Add domain.

Choose a Main Domain or Subdomain (image 4 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Choose a Main Domain or Subdomain" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Choose a Main Domain or Subdomain" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 4 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
Setup Guide
Now let's publish 5 DNS records in Namecheap
2 TXT records, 2 MX records, and 1 CNAME record — follow each sub-step carefully.

5Add Your DNS Records in Namecheap

Log in to Namecheap.com, then click Domain List → Manage.

Add Your DNS Records in Namecheap (image 5 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 5 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

Click Advanced DNS — this is where we'll add all 5 DNS records.

Add Your DNS Records in Namecheap (image 6 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 6 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
DNS Record 1 of 5
To Add the 1st TXT Record

Click Add New Record.

Add Your DNS Records in Namecheap (image 7 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 7 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

Select TXT Record from the dropdown.

Add Your DNS Records in Namecheap (image 8 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 8 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
Add Your DNS Records in Namecheap (image 9 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 9 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

A. Host: depending on the subdomain you're setting up:

  • mg.companyname.com → host name is mg
  • replies.companyname.com → host name is replies
  • Main domain (companyname.com) → host name is @

B. Value: head back to Mailgun and copy the first TXT record — it will look like v=spf1 include:mailgun.org ~all — and paste it here.

Add Your DNS Records in Namecheap (image 10 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 10 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

C. Click the green check to save.

DNS Record 2 of 5
To Add the 2nd TXT Record

Click Add New Record again, and select TXT Record from the dropdown.

Add Your DNS Records in Namecheap (image 11 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 11 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
Add Your DNS Records in Namecheap (image 12 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 12 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
Add Your DNS Records in Namecheap (image 13 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 13 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

A. Host: this one is a bit tricky — copy everything from the beginning until the subdomain part. Do not copy the main domain.

Add Your DNS Records in Namecheap (image 14 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 14 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

Examples — copy the highlighted part:

ScenarioScreenshot
Using a subdomain
Add Your DNS Records in Namecheap (image 15 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 15 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
Using the main domain
Add Your DNS Records in Namecheap (image 16 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 16 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

B. Value: paste the second, longer TXT record from Mailgun here.

Add Your DNS Records in Namecheap (image 17 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 17 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

C. Click the green check to save.

DNS Record 3 of 5
To Add the 1st MX Record

Scroll down to Mail Settings and switch the dropdown to Custom MX.

Add Your DNS Records in Namecheap (image 18 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 18 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
Heads Up

Switching to Custom MX will affect your existing Google Workspace account for incoming mail on the main domain if Gmail was originally selected. Make sure you're using a subdomain for Mailgun. See Can I Use the Same Domain Name for Mailgun and for Google Apps (Or Another Email Server)?

You'll need to add back the 5MX records for Google Gmail:

HostTTLPriorityValue
@36001ASPMX.L.GOOGLE.COM
@36005ALT1.ASPMX.L.GOOGLE.COM
@36005ALT2.ASPMX.L.GOOGLE.COM
@360010ALT3.ASPMX.L.GOOGLE.COM
@360010ALT4.ASPMX.L.GOOGLE.COM

Once all five MX records above are added back, add the Mailgun MX record. Click Add New Record.

Add Your DNS Records in Namecheap (image 19 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 19 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
Add Your DNS Records in Namecheap (image 20 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 20 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

A. Host: depending on the subdomain you're setting up:

  • mg.companyname.com → host name is mg
  • replies.companyname.com → host name is replies
  • Main domain (companyname.com) → host name is @

B. Value: mxa.mailgun.org

C. Priority: 10

D. Click the green check to save.

Add Your DNS Records in Namecheap (image 21 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 21 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
DNS Record 4 of 5
To Add the 2nd MX Record

A. Host: depending on the subdomain you're setting up:

  • mg.companyname.com → host name is mg
  • replies.companyname.com → host name is replies
  • Main domain (companyname.com) → host name is @

B. Value: mxb.mailgun.org

C. Priority: 10

D. Click the green check to save.

Add Your DNS Records in Namecheap (image 22 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 22 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com
DNS Record 5 of 5
To Add the CNAME Record

Scroll back up to the Host Records section and click Add New Record.

Add Your DNS Records in Namecheap (image 23 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 23 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

Select CNAME Record from the dropdown.

Add Your DNS Records in Namecheap (image 24 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 24 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

Head back to Mailgun to copy the host name — copy everything from the beginning until the subdomain part. Do not copy the main domain.

Add Your DNS Records in Namecheap (image 25 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 25 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

Go back to Namecheap:

Add Your DNS Records in Namecheap (image 26 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 26 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

A. Host: depending on the subdomain you're setting up:

  • mg.companyname.com → host name is email.mg
  • replies.companyname.com → host name is email.replies
  • Main domain (companyname.com) → host name is email

B. Value: mailgun.org

C. Click the green check to save.

Now that all 5 records have been added, go back to Mailgun and click Verify DNS Settings. Click the same button again if some records still aren't showing a green checkmark.

Add Your DNS Records in Namecheap (image 27 of 27) What this shows EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and… What this shows Illustrates the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". This screenshot appears in the "Add Your DNS Records in Namecheap" section of "Mailgun Setup - Namecheap Domain Setup". For context, this section explains: EMAIL INFRASTRUCTURE Step-by-Step Mailgun Setup: Namecheap Domain Setup Sign up for Mailgun, add your domain, and publish the TXT, MX, and CNAME records in Namecheap so your emails verify and deliver. What You'll Learn This guide covers creating a Mailgun account, adding a sending domain, choosing…. This part of the guide covers 9 fields, listed below. Image 27 of 27
Fields in this part of the guide mg.companyname.comreplies.companyname.comsupport.companyname.commg.companyname.com → host name is mgreplies.companyname.com → host name is repliesMain domain (companyname.com) → host name is @mg.companyname.com → host name is email.mgreplies.companyname.com → host name is email.repliesMain domain (companyname.com) → host name is email
Buttons and menus referenced Sending → Add New Domaincompanyname.comanything_here.companyname.comUSAdd domainDomain List → ManageAdvanced DNSAdd New RecordTXT RecordC.Do not copy the main domain.Mail Settings
All 3 steps in this procedure
  1. mg.companyname.com
  2. replies.companyname.com
  3. support.companyname.com

6Get Your API Key & Send a Test Email

Once all the DNS records are added and verified, grab your key from Mailgun API Key: Where to Find It in Mailgun and Add It to the Platform.

You're Almost Done

Send a test email to confirm everything works. See How to Send a Test Email in the Conversation for the steps.

Video Recap
Video 1 Open in a new tab

8Frequently Asked Questions

Q: Will switching to Custom MX break my existing Gmail or Google Workspace email?
It can, if you're adding the MX records to your main domain and it's already used with Google Workspace. Re-add all 5 Google MX records alongside the Mailgun ones, and consider using a subdomain instead to avoid the risk entirely.
Q: What's the difference between the "Host" value for the TXT/MX records and the CNAME record?
For TXT and MX records, the host is just your subdomain (e.g. "mg"). For the CNAME record, Namecheap expects "email.mg" — the tracking subdomain Mailgun uses for click and open tracking.
Q: My records aren't showing a green checkmark after verifying — what should I do?
DNS changes can take time to propagate. Double-check each host and value against what Mailgun shows, then click Verify DNS Settings again after a few minutes.
Q: Why do I need two separate TXT records?
The first TXT record is your SPF record, which authorizes Mailgun to send on your behalf. The second, longer TXT record is your DKIM key, which cryptographically signs your outgoing mail.
Q: Do I need to copy the exact values shown in this guide, or the ones from my own Mailgun account?
Always copy the exact host and value strings shown in your own Mailgun dashboard — the mxa.mailgun.org and mxb.mailgun.org values are standard, but your TXT record values are unique to your domain.
Q: Can I use this same process for a domain provider other than Namecheap?
The record types and values are the same everywhere, but the interface for adding them differs by provider. Check the related provider-specific setup guides below.

Was this guide helpful?

Related guides