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 of email host 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 it will be 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
Site IPThis 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

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 are going to 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 into cPanel.
  2. Select Domains from the left-hand menu.
  3. Locate and click Advanced Zone Editor.

    HostGator cPanel Advanced Zone Editor

  4. In the Advanced Zone Editor section, select your domain from the dropdown menu.
  5. Once your domain name is selected, a list of Zone File Records will populate towards the bottom of the page. Here is where you need to configure your MX record destination.
  6. 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 Site IP, then there is no need to change it or add a new one. If you wish to check if mail.yourdomain.com is using the correct Site IP, please click the expand below.

      To locate your Site IP Address:

      1. Log into cPanel.
      2. In the cPanel homepage, locate the General Information section on the right-hand side.
      3. This section will display your server information including, your Site IP Address.

        cPanel - Site IP

    • If there is no existing A record for mail.yourdomain.com, add a new A record using your cPanel's Site IP.

      To add a new A record:

      1. Log into cPanel.
      2. Click Domains from the left side menu.
      3. Select your domain name from the dropdown menu.
      4. In the Add a Record section, provide the necessary details.

        cPanel - Add A record

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

      5. Click the Add Record button.

      You will now see your newly added A record at the bottom of the page.

  7. Return to the cPanel homepage.
  8. In the Email section, click MX Entry.

    HostGator cPanel MX Entry

  9. Select your domain from the dropdown menu.
    cPanel - Email Routing
    Note: A section will show several email routing options – 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.
  10. For the email routing in this scenario, select Local Mail Exchanger.
  11. Go to the Add New Record section. This is where your MX record is displayed. If mail.yourdomain.com is not yet in this section, fill up the necessary fields.
    Priority: 0
    Destination: mail.yourdomain.com (Please replace yourdomain.com with your actual domain name)

    add record

    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 to use when delivering emails.
  12. 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, then 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.

I Have My Preferred Email Host's MX Destination

If the record provided is an MX destination, you can simply update it using the MX Entry icon from within cPanel.

  1. Log into cPanel.
  2. Select Email from the left side menu.
  3. Click on the MX Entry icon.

    mx entry

  4. Once your domain name is selected, the current MX Records will populate towards the bottom of the screen.
    add record
  5. Click on the Edit link from the Actions column and replace the entry with what was provided by your email hosting provider.

  6. Click the Edit button to finalize your changes.

  7. Lastly, on the same page, 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, then you will first have to create an A record and then set the new MX Destination.

  1. Log into cPanel.
  2. Click Domains from the left side menu.
  3. Select your domain name from the dropdown menu.
  4. In the Add a Record section, provide the necessary details.

    cPanel - Add A record

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

  5. Click the Add Record button.
  6. Return to the cPanel homepage.
  7. In the Email section, click MX Entry.

    HostGator cPanel MX Entry

  8. Select your domain from the dropdown menu.
  9. Once your domain name is selected, the current MX Records will populate at the bottom of the screen.
  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 Edit button to finalize your changes.
  12. Lastly, on the same page, 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 Site IP Address to point your emails.

  1. Find your HostGator Site 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 Site 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 regarding the creation of the A record, and updating 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? Contact us via phone or Live Chat so we can assist you.