# HostGator Domain Setup

### Introduction

Setting up custom domains with Mailgun can be a bit challenging for some users. This guide aims to simplify the process, using a video tutorial as a reference. By the end, you'll have a clear understanding of how to set up Mailgun custom domains, particularly with Hostgator, though the principles can be applied to any DNS provider.

### Overview

The process involves:

1. Logging into Mailgun and your DNS provider (Hostgator in this example).
2. Creating a subdomain in Mailgun.
3. Adding the necessary DNS records in your DNS provider.
4. Verifying the DNS records in Mailgun.

1\. Sign up for [Mailgun.com](https://signup.mailgun.com/new/signup)

2\. Check your email inbox to verify the email address

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284378416/original/VewuZVN3oFOFIvBdf4XqMAOX4vtVGv_jNg.png?1677630998" alt=""><figcaption></figcaption></figure>

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284378421/original/GU6IL6Y3N81qm6KMH9aTz7l5FV5IEv7ySA.png?1677630999" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284378418/original/kxsnymCeuFAsBWkXaOes6QaaWED2_bfASA.png?1677630999" alt=""><figcaption></figcaption></figure>

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

A. Main domain:

* If you are adding the main domain,[ it should not be used with Gsuite, or any other email provider](https://help.mailgun.com/hc/en-us/articles/203357040-Can-I-Use-the-Same-Domain-Name-for-Mailgun-and-for-Google-Apps-Or-Another-Email-Server-)&#x20;

&#x20;   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.**&#x20;

C. Click on **Add domain**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284382652/original/woVjMqNw3YY_Zjs20LoBHUb4KrThVvj_Rw.png?1677635102" alt=""><figcaption></figcaption></figure>

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.

<figure><img src="https://help.mailgun.com/hc/article_attachments/8759612958491/Screen_Shot_2022-09-11_at_6.39.22_PM.png" alt=""><figcaption></figcaption></figure>

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 <a href="#to-add-the-1st-txt-record" id="to-add-the-1st-txt-record"></a>

1. Log in to [cPanel](https://portal.hostgator.com/hosting/cPanel/sso-redirect?redirect=/frontend/paper_lantern/).
2. Look for the **Domains** section, then click **Zone Editor**.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284388376/original/0ObShEaAQ6GXG-G-sSlIwX_9uLXpFUjdCA.png?1677640303" alt=""><figcaption></figcaption></figure>
3. On the next page, Locate your domain in the **Zone Editor** section, then click its **Manage** button.

   <figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284388585/original/ZsKY3OvmFHtUBZWXElGKPG31Nl51EuXcFA.png?1677640464" alt=""><figcaption></figcaption></figure>
4. Click **Manage** to view the domain's complete set of DNS records.
5. Click the **+Add Record** button and select **Add "TXT" Record**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284388748/original/NLKDFwtDUhzgL1MKCSJEt-0sZ8a-ZR0JaA.png?1677640597" alt=""><figcaption></figcaption></figure>

<br>

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
  * [mg.companyname.com](https://mg.companyname.com/) The host name will be **mg**
  * [replies.companyname.com](https://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. Record: Same for everyone

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

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284389338/original/L_D8amxfS4rLqz8NkwMDjBWCqAuPnFqSiw.png?1677641215" alt=""><figcaption></figcaption></figure>

C. Click on **Add Record**<br>

### To add the 2nd TXT record <a href="#to-add-the-2nd-txt-record" id="to-add-the-2nd-txt-record"></a>

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

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284388748/original/NLKDFwtDUhzgL1MKCSJEt-0sZ8a-ZR0JaA.png?1677640597" alt=""><figcaption></figcaption></figure>

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284389413/original/bZ319PXDv8_TwakgxeWsjd6r5-6KFjcfAA.png?1677641278" alt=""><figcaption></figcaption></figure>

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**

<br>

Examples: **copy the highlighted part ONLY**

| <p>Example 1 using subdomain:</p><p><br></p><p>Copy mx.\_domainkey.helpdesk as the host name</p> | [![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284380215/original/t6MGY8Bw9AK1Vv01kUxtJAkNwp_4UfYjHw.png?1677632945)](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284380215/original/t6MGY8Bw9AK1Vv01kUxtJAkNwp_4UfYjHw.png?1677632945) |
| ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>Example 2 using main domain:</p><p><br></p><p>Copy mailo.\_domainkey as the host name</p>     | [![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284380223/original/JSERXQQhYNvzVp7YoXhIji_yeomZNLXUKA.png?1677632951)](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284380223/original/JSERXQQhYNvzVp7YoXhIji_yeomZNLXUKA.png?1677632951) |

B. Record: different for everyone

&#x20;   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

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284385043/original/UvAhE3LGN5sYkTb4kyEsXNM0GE0Uc8Eq1Q.png?1677637220" alt=""><figcaption></figcaption></figure>

C. Click on **Add Record**

<br>

<br>

### To add the 1st MX records <a href="#to-add-the-1st-mx-records" id="to-add-the-1st-mx-records"></a>

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284385538/original/qHcrrZPnp3g0LC4c75qM1hg_opwYUXgE0w.png?1677637720" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284389907/original/18xrjivpU7RYPDJqHY2wnce79K3AkwJe0A.png?1677641569" alt=""><figcaption></figcaption></figure>

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)?](https://help.mailgun.com/hc/en-us/articles/203357040-Can-I-Use-the-Same-Domain-Name-for-Mailgun-and-for-Google-Apps-Or-Another-Email-Server-)

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284390505/original/nO1ZhMzBXp4ZqlhfzX1QYLxgGT0_ET-_vg.png?1677642035)

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](https://mg.companyname.com/) The host name will be **mg**

[replies.companyname.com](https://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

&#x20;   paste the following data **mxa.mailgun.org**&#x20;

E. Click on **Save Record**

### To add the 2nd MX records <a href="#to-add-the-2nd-mx-records" id="to-add-the-2nd-mx-records"></a>

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

This time we need to add another record for mx**B**.mailgun.org&#x20;

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284389907/original/18xrjivpU7RYPDJqHY2wnce79K3AkwJe0A.png?1677641569" alt=""><figcaption></figcaption></figure>

![](https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284390505/original/nO1ZhMzBXp4ZqlhfzX1QYLxgGT0_ET-_vg.png?1677642035)

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](https://mg.companyname.com/) The host name will be **mg**

[replies.companyname.com](https://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

&#x20;   paste the following data **mxb.mailgun.org**&#x20;

E. Click on **Save Record**

### To add the CNAME record <a href="#to-add-the-cname-record" id="to-add-the-cname-record"></a>

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284385721/original/3LyKoigujZ-vEjMFQDflCfmRRfAJra3rYA.png?1677637907" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284390884/original/13yHoywGcgf3oSslLKzD03Sj9MAxoJQGfA.png?1677642360" alt=""><figcaption></figcaption></figure>

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284391213/original/QLb8ArxkgSrQsXJzo63PddCcQRhylQBGHw.png?1677642643" alt=""><figcaption></figcaption></figure>

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**

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284385985/original/OtLw_A4zY8FbLbBKqMB9kUKRaQJO3xpp8A.png?1677638165" alt=""><figcaption></figcaption></figure>

B. Record: Same for everyone

&#x20;       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 checkmark

<figure><img src="https://s3.amazonaws.com/cdn.freshdesk.com/data/helpdesk/attachments/production/48284387965/original/I7T5QQCSjAnBvT1zqQlVgXSuNdgfuNiM3w.png?1677639928" alt=""><figcaption></figcaption></figure>

### Conclusion

Setting up custom domains with Mailgun is a straightforward process once you understand the steps. This guide, combined with the video tutorial, should provide you with all the information you need to successfully set up your custom domain. Remember, while this example used GoDaddy, the principles remain the same for other DNS providers.
