1. Knowledge Base
  2. >
  3. Results
  4. >
  5. How to Set Up Your MX (Mail Exchange) Record

How to Set Up Your MX (Mail Exchange) Record

This article discusses how to set up your MX records (emails) based on your preferred setup.

  • If your domain is pointed to HostGator's name servers and:
    • you want to host your emails with HostGator, go to Scenario 1.
    • you want to host your emails with another hosting provider, go to Scenario 2.
  • If your domain is not pointed to HostGator's name servers, and you wish to host your emails with HostGator, go to Scenario 3.

Here is a list of terminologies related to setting up emails that you may encounter below and in other supporting articles.

TermDescription
Name ServersThis is the server that hosts your DNS zone files. For more information, please visit this article: What Are My Name Servers?

Example: ns1234.hostgator.com and  ns5678.hostgator.com.
Email HostThis is the service provider that hosts or handles your emails on their servers. 
Domain PointingThe process of setting up the server where you wish to host a service like your website or emails.
Email RoutingThis is a setting that tells HostGator how to handle your emails, whether hosted locally (by HostGator) or remotely (by a different host). For more information, please refer to this article: Local, Backup, and Remote Mail Exchanger.
MX RecordsThese are the DNS records responsible for handling your emails.
Example: mail.yourdomain.com
Shared IP (formerly Site IP)This is the IP address found in the General Information section on the right-hand side of your cPanel.


To check your domain name's current name servers and MX records, you can use these online tools:


Below are some examples of commonly used MX records:

ProviderMX Record Value
cPanel

mail.example.com

Reference: MX Entry

Google Workspace

(Formerly G Suite)

ASPMX.L.GOOGLE.COM
ALT1.ASPMX.L.GOOGLE.COM
ALT2.ASPMX.L.GOOGLE.COM
ALT3.ASPMX.L.GOOGLE.COM
ALT4.ASPMX.L.GOOGLE.COM

Reference: Google Workspace MX record values

Microsoft 365

example-com.mail.protection.outlook.com

Reference: Add DNS records to connect your domain

 

Note: Replace example.com with your actual domain name.

Scenario 1 – I Have HostGator Name Servers, How Do I Point My Email To HostGator?

Description:

  • If the domain is added to your hosting plan and the only change was pointing the domain to HostGator name servers, then there is no need to change the MX records.
    Why? When your domain is added to your hosting plan, a default DNS zone file is also created as if all services will be handled locally in the HostGator server. This means, by default, the MX records are automatically configured to point to HostGator, making HostGator the host of your emails.
  • If your domain is pointing to HostGator name servers with your emails hosted by a different provider, but you wish for HostGator to handle your emails instead, then you will need to update your MX records and email routing and point them to HostGator.
    Why? Since your emails are being hosted by another provider, changing your MX records and email routing is like giving HostGator permission to host your emails.

To point your MX records to HostGator: 

  1. Log in to cPanel.
  2. In the Domains section of the cPanel home screen, click Zone Editor.

    cPanel - Zone Editor

  3. Locate the domain you want to modify, and then click Manage.

    cPanel - Zone Editor

  4. Look through the list of zone files and see if there is already an existing A record for mail.yourdomain.com.
    (Note: Please replace yourdomain.com with your actual domain name).

    A Record for your Mail

    • If there is an existing A record for mail.yourdomain.com with the correct HostGator Shared IP, there is no need to change or add a new one. If you wish to check if mail.yourdomain.com uses the correct Shared IP, please click the expand below.
      How to Identify your Shared IP

      To locate your Shared IP Address:

      1. Log in to cPanel.
      2. On the cPanel homepage, locate the General Information section on the right-hand side.
      3. This section will display your server information, including your Shared IP Address.

        cPanel - Shared IP Address

    • If there is no existing A record for mail.yourdomain.com, add a new A record using your cPanel's Shared IP Address.
      How to Add an A Record

      To add a new A record:

      1. Log in to cPanel.
      2. Navigate to the Domains section, then click Zone Editor.
        cPanel - Zone Editor
      3. Locate the domain you want to modify, and then click +A Record.
      4. In the Add an A Record section, provide the necessary details.

        cPanel - Add A record
        Name: mail (The Name box will automatically populate with the MX record's subdomain and selected domain name – mail.yourdomain.com)
        Address: Your cPanel Shared IP Address

      5. Click the Add An A Record button.
  5. Once done, return to the cPanel homepage.
  6. In the Email section, click Email Routing.

    HostGator cPanel MX Entry

  7. Select your domain from the dropdown menu. For the Email Routing in this scenario, select Local Mail Exchanger.

    cPanel - Email Routing

    This section will show several email deliverability methods – Automatically Detect Configuration, Local Mail Exchanger, Backup Mail Exchanger, and Remote Mail Exchanger. For more information about these options, please see Local, Backup, and Remote Mail Exchanger.

  8. To manage MX records, use the Zone Editor. This is where your MX record is displayed. If mail.yourdomain.com is not yet in this section, click + Add Record and select MX in the type dropdown. Fill out the necessary fields.

    add record


    Priority: 0
    Destination: mail.yourdomain.com
    (Please replace yourdomain.com with your actual domain name)
    What would happen if two MX Records have the same priority?
    The lowest-numbered priority is the most preferred. If two MX Records have the same priority, the SMTP Sending Server will select one at random when delivering emails.
  9. To avoid confusion in the MX records, you can delete other MX records other than mail.yourdomain.com by clicking the Remove link from the Actions column.

Your email will now be hosted locally on your HostGator package.


Scenario 2 – I Have HostGator Name Servers, How Do I Point My Email Away From HostGator?

Description:

If you wish to use your HostGator name servers but host your emails with another hosting provider, you only need to update your MX records. First, you will need to obtain the MX destination for the new mail hosting provider. This will either exist as a complete MX record or IP address.

Click the link describing what your preferred email host has provided you.

  • MX destination (Example: mailhosting.example.net, onemail.example.info, mail.example.net, etc.)
  • IP Address (Example: 111.222.33.44)
I Have My Preferred Email Host's MX Destination

If the record provided is an MX destination, you can update it using the Zone Editor from within cPanel.

  1. Log in to cPanel.
  2. Click Zone Editor from the Domains section.

    cPanel - Zone Editor

  3. From the domain list, click Manage on the far right of the domain you want to modify.

    mx entry

  4. Locate the current MX Record entry that you want to edit, then click Edit.
  5. Replace the entry with what was provided by your email hosting provider.

    Edit MX Records

  6. Click the Save Record button to finalize your changes.

  7. Lastly, you will need to set the email routing option to Remote Mail Exchanger.

    cPanel- Set Up Email Routing

  8. Once done, click Change.

Your mail will now be hosted remotely with your new email provider.

I Have My Preferred Email Host's IP Address

If you are provided an IP address from your new email provider, you will first have to create an A record and then set the new MX Destination.

  1. Log in to cPanel.
  2. Click Zone Editor from the Domains section of the cPanel.
  3. Locate the domain you want to modify, then click +A Record.
  4. In the Add an A Record section, provide the necessary details.

    cPanel - Add A record


    Name: mail (The Name box will automatically populate with the MX record's subdomain and selected domain name – mail.yourdomain.com)
    Address: Your email host's IP Address

  5. Click the Add An A Record button.
  6. Once done, return to the cPanel homepage.
  7. In the Domains section, click Zone Editor.

    HostGator cPanel MX Entry

  8. Locate your domain name and then click Manage.
  9. Look for the MX record entry that you want to edit.
  10. Click on the Edit link from the Actions column and replace the entry with the name of the A record created in Step 4.
  11. Click the Save Record button to finalize your changes.
  12. Lastly, you will need to set the email routing option to Remote Mail Exchanger.

    cPanel- Set Up Email Routing

  13. Once done, click Change.

Your mail will now be hosted remotely with your new email provider.


Scenario 3 – I Do NOT Have HostGator Name Servers. How Do I Point My Email To HostGator?

Description:

If your domain name is pointing to a different host's name servers, but you wish to host your emails with HostGator, you will need to update your MX records at the hosting company where your name servers are or at your domain's registrar.
Why? Any change in the DNS records will only take effect if it is updated through the name servers' hosting company or domain's registrar.

Depending on your remote host or registrar, you can either use HostGator's MX destination (mail.yourdomain.com) or HostGator's Shared IP Address to point your emails.

  1. Find your HostGator Shared IP address. How to Find HostGator's Site IP Address?
  2. Create an A record for your emails at your remote hosting provider. Use your HostGator Shared IP address as your A record.
  3. Once you have a new A record created, modify your MX Destination and email routing at your remote hosting provider.
  4. If additional assistance is needed to create the A record and update the current MX destination and email routing at your remote hosting provider, please contact your remote host.

Your mail will now be hosted with HostGator.

Have further questions? Please contact us via phone or Live Chat so we can assist you!