Mailgun Setup - Namecheap Domain Setup

Modified on Sat, 27 Apr at 4:14 PM

Step-by-step Mailgun Setup - Namecheap Domain Setup



1. Sign up for Mailgun.com



2. Check your email inbox to verify the email address



3. Login to Mailgun, Click on Sending > Add New Domain




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


A. Main domain:

    Subdomain:

  • To set up the subdomain with Mailgun, you can type ANYTHING_HERE.companyname.com
    • Examples:
      • mg.companyname.com
      • replies.companyname.com
      • support.companyname.com

B. Please set up the domain or subdomain under US, not EU. not EU. not EU. 

C. Click on Add domain





5. Now log in to your DNS records based on where you get the domain and add the 5 DNS records.


Log in to Namecheap.com

Click on Domain List > Manage 


Click on Advanced DNS, we are going to add 5 DNS records







To add the 1st TXT record



Click on Add New Record





Select TXT Record from the dropdown





A. Host:


Depending on the subdomain you are trying to set up, if you are trying to set up

mg.companyname.com The host name will be mg

replies.companyname.com The host name will be replies


If you are setting up a main domain like companyname.com, the host name will be @


B. Head back to Mailgun and Copy the first TXT record here v=spf1 include:mailgun.org ~all

Value: we will paste the first copied TXT record here v=spf1 include:mailgun.org ~all



C. Click on the green check




To add the 2nd TXT record


Click on Add New Record




Select TXT Record from the dropdown






A. Host:


it's a bit tricky but the key here is to copy everything from the beginning until the subdomain part, DO NOT copy the main domain




Examples: copy the highlighted part

Example 1 using subdomain

Example 2 using main domain:



B. Value: we will paste the second long TXT record here 



C. Click on the green check



To add the 1st MX records

Scroll down to MAIL SETTINGS


Switch the dropdown to Custom MX



This will affect your existing Gsuite account to capture incoming emails for the main domain if you have Gmail selected originally. Make sure you are using a subdomain for Mailgun. 


You will need to add back 5 MX records for Google Gmail:

HostTime to Live (TTL*)PriorityValue
@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 you add back all FIVE MX records above, we can then add our MX records for Mailgun


Click on Add New Record



A. Host:


Depending on the subdomain you are trying to set up, if you are trying to set up

mg.companyname.com The host name will be mg

replies.companyname.com The host name will be replies

If you are setting up a main domain like companyname.com, the host name will be @



B. Value: paste the following data mxa.mailgun.org

C. Priority is 10

D. Click the green check




To add the 2nd MX records


A. Host:


Depending on the subdomain you are trying to set up, if you are trying to set up

mg.companyname.com The host name will be mg

replies.companyname.com The host name will be replies

If you are setting up a main domain like companyname.com, the host name will be @



B. Value: paste the following data mxb.mailgun.org

C. Priority is 10

D. Click the green check





To add the CNAME record


Scroll back up to the top section named HOST RECORDS


Click on Add New Record


Select CNAME Record from the dropdown



Head back to Mailgun to copy the host name, it's a bit tricky but the key here is to copy everything from the beginning until the subdomain part, DO NOT copy the main domain


Go back to Namecheap:


A. Host:


Depending on the subdomain you are trying to set up, if you are trying to set up

mg.companyname.com The host name will be email.mg

replies.companyname.com The host name will be email.replies

If you are setting up a main domain like companyname.com, the host name will be email



B. Value: paste the following data mailgun.org

C. Click the green check




Now that you have added 5 records, Go back to Mailgun and click on Verify DNS Settings


Click the same button to Verify DNS Settings again if some records are still not showing the green checkmark





A video to recap:

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article