MailGun Setup - HostGator Domain Setup

Modified on Fri, 12 Jan at 3:40 PM

Step-by-step Mailgun Setup - HostGator 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

The next screen that you're taken to will ask you to add DNS records to your domain. Leave this screen open for the next step.

Screen Shot 2022-09-11 at 6.39.22 PM.png

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


To add the 1st TXT record

  1. Log in to cPanel.

  2. Look for the Domains section, then click Zone Editor.
    cPanel - Zone Editor

  3. On the next page, Locate your domain in the Zone Editor section, then click its Manage button.
    Zone Editor - Manage

  4. Click Manage to view the domain's complete set of DNS records.

  5. Click the +Add Record button and select Add "TXT" Record


A. Name: Different for everyone, DO NOT INCLUDE THE ROOT DOMAIN

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

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

B. Record: Same for everyone

  • paste the following record v=spf1 include:mailgun.org ~all



C. Click on Add Record

To add the 2nd TXT record

Click the +Add Record button and select Add "TXT" Record again

A. Name: it's a bit tricky but the key here is to copy everything from the beginning until the subdomain part, DO NOT INCLUDE THE ROOT DOMAIN

**Everyone's 2nd TXT record Host Name and record is different

Examples: copy the highlighted part ONLY

Example 1 using subdomain:

Copy mx._domainkey.helpdesk as the host name

Example 2 using main domain:

Copy mailo._domainkey as the host name

B. Record: different for everyone

    Head back to Mailgun and Copy the 2nd TXT record here highlighted in the screenshot below

  • Record: paste the 2nd very long copied TXT record here

C. Click on Add Record

To add the 1st MX records


Click the +Add Record button and select Add "MX" Record

If you have a Gsuite account to capture incoming emails for the main domain. Make sure you are using a subdomain for Mailgun. Check out Can I Use the Same Domain Name for Mailgun and for Google Apps (Or Another Email Server)?

A. Name: Different for everyone

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. Priority is 10 which is also same for everyone no matter what domain you are trying to set

C. Destination: Same for everyone

    paste the following data mxa.mailgun.org 

E. Click on Save Record

To add the 2nd MX records

Click the +Add Record button and select Add "MX" Record

This time we need to add another record for mxB.mailgun.org 

A. Name: Different for everyone

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. Priority is 10 which is also same for everyone no matter what domain you are trying to set

C. Destination: Same for everyone

    paste the following data mxb.mailgun.org 

E. Click on Save Record

To add the CNAME record

Click the +Add Record button and select Add "CNAME" Record

A. Name: Different for everyone

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

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. Record: Same for everyone

        paste the following data mailgun.org

C. Click on Save Record

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 checkmar


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

Feedback sent

We appreciate your effort and will try to fix the article