
Email routing in cPanel is a crucial component of managing your email services for a domain.
It defines how emails are processed and delivered for the accounts on your hosting server.
Whether you’re hosting emails locally or routing them through a third-party mail provider like Google Workspace or Microsoft 365, configuring email routing in cPanel properly ensures that emails sent to your domain arrive at the right destination.
Table of Contents
This guide will cover the basics of email routing in cPanel, explain the different types of email routing options, provide step-by-step instructions for configuring email routing in cPanel, and address common troubleshooting scenarios.
What is Email Routing?
Email routing refers to how incoming email messages are directed when they reach your domain.
When someone sends an email to an address on your domain (e.g., you@example.com
), the server checks its routing configuration to determine where to deliver the message.
You can choose to have your server handle the email (local delivery) or forward it to an external mail service (remote delivery).
Email routing also helps avoid issues like email loops, where the same message is passed back and forth between two servers, and ensures that emails aren’t misrouted due to incorrect settings.
Types of Email Routing in cPanel
cPanel offers several email routing options. Understanding these options helps you select the appropriate setting based on your email hosting arrangement:
1. Local Mail Exchanger (Local Delivery)
- When set to Local Mail Exchanger, the server will handle email delivery for the domain locally. This option should be used if your email accounts are hosted on the same server where your website resides.
- When to Use:
- You’re hosting email accounts directly on the server (e.g., using cPanel’s built-in email services).
- Your domain’s MX (Mail Exchanger) records point to the same server.
2. Backup Mail Exchanger
- The Backup Mail Exchanger option configures the server as a backup mail server. If the primary mail server is unavailable, this server will temporarily accept and store emails until the primary server is back online.
- When to Use:
- You have a primary mail server, and the cPanel server acts as a secondary (backup) mail server.
- This is typically used in larger organizations with multiple mail servers.
3. Remote Mail Exchanger (External Delivery)
- When set to Remote Mail Exchanger, emails for the domain are forwarded to an external mail server (e.g., Google Workspace or Microsoft 365). In this case, your cPanel server will not handle mail delivery.
- When to Use:
- You’re using a third-party email service to handle email delivery.
- Your domain’s MX records point to the external mail service’s servers.
4. Automatically Detect Configuration
- In this mode, cPanel attempts to detect whether the email should be handled locally or remotely based on the domain’s MX records.
- When to Use:
- If you’re unsure which option to choose, this can be a safe fallback. However, manually configuring email routing in cPanel is generally more reliable.
Step-by-Step Guide to Configure Email Routing in cPanel
Now that you understand the types of email routing available, let’s walk through how to configure email routing in cPanel:
1. Log into cPanel
- Access your cPanel dashboard by visiting
https://example.com:2083
or through your hosting provider’s portal. - Use your username and password to log in.
2. Navigate to Email Routing
- Once inside cPanel, scroll down to the Email section and click on Email Routing in cPanel.
3. Select the Domain
- If your cPanel account manages multiple domains, you will see a dropdown list to choose the domain for which you want to configure email routing in cPanel.
- Select the domain you wish to configure from the list.
4. Choose the Email Routing Option
- In the Configure Email Routing section, you will see the different routing options (Local Mail Exchanger, Backup Mail Exchanger, Remote Mail Exchanger, Automatically Detect Configuration).
- Based on your setup, choose the appropriate option:
- Local Mail Exchanger: Use if you are hosting emails locally on the server.
- Remote Mail Exchanger: Use if you are routing email through a third-party email provider (e.g., Google Workspace).
- Backup Mail Exchanger: Use if this server is a backup server.
- Automatically Detect: Use if you want cPanel to automatically configure the best option based on your MX records.
5. Save the Changes
- After selecting the appropriate email routing in cPanel option, click Change or Save to apply the new settings.
6. Verify the MX Records
- cPanel email routing is closely tied to your domain’s MX records. To ensure proper delivery, verify that the MX records are set correctly for your domain.
- You can check the MX records by going to the Zone Editor in cPanel or through your DNS provider’s control panel.
- Example of a typical MX record for a domain using local delivery
10 mail.example.com
- If you’re using a third-party email provider like Google Workspace or Microsoft 365, you’ll need to update the MX records accordingly:
- For Google Workspace:
1 ASPMX.L.GOOGLE.COM
5 ALT1.ASPMX.L.GOOGLE.COM
5 ALT2.ASPMX.L.GOOGLE.COM
10 ALT3.ASPMX.L.GOOGLE.COM
10 ALT4.ASPMX.L.GOOGLE.COM
- For Microsoft 365:
0 example-com.mail.protection.outlook.com
Understanding MX Records and Their Impact on Email Routing
MX Records (Mail Exchanger records) are DNS records that tell sending mail servers where to deliver emails for a domain. The priority value associated with each MX record determines the order in which servers attempt delivery.
- Priority: The lower the number, the higher the priority. Mail will always be delivered to the highest priority server first. If the highest priority server is unavailable, mail will be delivered to the next available server.
If your MX records point to an external service (like Google or Microsoft), the routing must be set to Remote Mail Exchanger. If your MX records point to your cPanel server, the routing must be set to Local Mail Exchanger.
Common Scenarios and Email Routing Setup Examples
Scenario 1: Local Email Hosting
You have email accounts hosted on your cPanel server, and you want all emails for example.com
to be delivered locally.
- Routing Setting: Local Mail Exchanger
- MX Record:
10 mail.example.com
Scenario 2: Using Google Workspace for Emails
You want Google Workspace to handle all email services for your domain, while your website is hosted on the cPanel server.
- Routing Setting: Remote Mail Exchanger
- MX Records:
1 ASPMX.L.GOOGLE.COM
5 ALT1.ASPMX.L.GOOGLE.COM
5 ALT2.ASPMX.L.GOOGLE.COM
10 ALT3.ASPMX.L.GOOGLE.COM
10 ALT4.ASPMX.L.GOOGLE.COM
Scenario 3: Backup Mail Server
Your company uses an external mail server, but the cPanel server acts as a backup in case the primary mail server is down.
- Routing Setting: Backup Mail Exchanger
- MX Records:
- Primary MX:Copy code
0 primarymailserver.com
- Backup MX:Copy code
20 backupmailserver.example.com
- Primary MX:Copy code
Troubleshooting Common Issues with Email Routing
- Emails Not Being Delivered:
- Check if the MX records for the domain are correct.
- Verify that email routing is set to the appropriate setting (local or remote) based on where the MX records point.
- Email Loops:
- This can occur if both your server and an external mail server are trying to handle emails for the same domain. Ensure the MX records and routing settings are correctly configured to avoid loops.
- Emails Marked as Spam:
- If emails from your domain are being flagged as spam, ensure that your server’s SPF, DKIM, and DMARC records are properly set up.
Conclusion
Configuring email routing in cPanel is an essential task for ensuring that emails are delivered correctly, whether you’re hosting them locally or using a third-party provider.
By understanding the different routing options (Local, Remote, Backup), verifying MX records, and properly configuring your DNS, you can ensure a smooth email experience for your domain.
Always double-check routing settings, MX records, and DNS configurations when making changes, as incorrect settings can lead to email delivery issues.