How to configure Google Mail / Gmail MX Records in cPanel

269ac00f765508cb74b25d006dbf5bb2

Written by Dennis Nind

Last published at: February 8th, 2019

An MX (mail exchange) record is an entry in your DNS zone file which specifies a mail server to handle a domain's email. You must configure an MX record to receive email to your domain. To configure MX records on a DNS Zone, they require a Priority and a Destination. Priority - is number allows you to determine the order of preference for your MX Destinations. It only becomes relevant when you have more than a single MX record. The lowest Priority record should be the first port of call when another mail server tries to send an email into your domain.  It doesn't really matter what numbers you use - it's the numerical order of them that is important - but it's most common to use 0, 10, 20 etc Destination - is a fully qualified domain name. That is to say, it must be resolvable by the public DNS to an IP address. IP addresses are NOT allowed as MX destinations.


Step 1 - Accessing the MX records

google.email

 You can see your domain's MX records, by logging into cPanel and clicking on the MX Entry icon.


Step 2 - Choose the domain If you have parked or added on any domains to your cPanel account then you will need to choose the domain from the Domain drop-down control.


Step 3 - Configure domain as Remote Mail Exchanger

email routing on google mail 

Because you want to route your email to an external mail provider instead of delivering incoming mail into your cPanel's mailboxes, you must set your domain as a Remote Mail Exchanger, as shown. Essentially, the option selected under “Email Routing for” tells cPanel how you would like the mail services for the domain handled. Unless you have a specific setup that needs these explicitly stated, the recommended option is “Automatically Detect Configuration.” The separate options mean:

  • Local Mail Exchanger: Handle all mail sent from the server to this domain locally; i.e. – deliver it to the mailbox that is on the server rather than a remote mail service.
  • Remote Mail Exchanger: Handle all mail sent to this domain remotely; i.e. – deliver it to the mail service determined by the domain’s MX record. (For example, if you have Google Apps set up as your domain’s mail service, deliver the emails to the mailbox on Google’s servers rather than your cPanel server)
  • Backup Mail Exchanger: Handle all emails like a remote mail exchanger, unless the remote service is unreachable, in that case handle it like a local mail exchanger. (For example, if you have Google as the mail service for the domain, then send the emails to Google’s servers like the remote mail exchanger. If for some reason Google’s servers are inaccessible, then deliver the mail locally, as in the local mail exchanger option.)

Of course, Google Mail is a remote mail exchanger, therefore 'Remote' should be selected. This prevents other accounts on the same server relaying messages to its local mailboxes, and instead forces the Exim configuration to relay the message 'outbound'


Step 4 - Delete any existing MX records Look at the bottom of the MX Entry Maintenance screen to find the MX Records table. Delete all existing records by clicking the Delete link and confirming the deletion in each case.


Step 5 - Add the Google Apps MX entries

MX records for Google Mail

 Add each MX entry as required by Google Apps then click the Add New Record button - The example below shows the first record being added. Your settings may differ slightly depending on your instructions from Google.



MX entries for gmail

 Keep adding the required records until the list of MX Records at the bottom of the screen looks like the image below.


Step 6 - Authorise Google Apps to send email for your domain

 Go back to your cPanel main page by clicking the little Home icon at the top left. Then, click on the Authentication icon.



enable spf records for gmail

 If SPF is not already enabled, enable it by clicking the Enable button.



 Once SPF is enabled, scroll down to the Include List (INCLUDE) section and click the Add button.



google spf record entry

 Enter _spf.google.com into the box provided, and click OK, or Save (depending on your browser it may be either).



google mail - save spf changes

 You should now see your entry in the Include List (INCLUDE) section. Then, making sure the options at the bottom match the example shown below, click the Update button to save your changes. The system should report your new SPF record, which should include the text +include:_spf.google.com.  That's all, folkes!