When managing mail routing on a cPanel server, it's important to understand the role of the files /etc/localdomains
and /etc/remotedomains
. These files determine whether a domain's email should be handled locally by the server or routed to a remote mail server. Misconfigurations in these files can lead to issues with sending or receiving emails. In this guide, we’ll explain what these files do and how you can rebuild them using a simple SSH command to ensure proper mail routing for all domains on your server.
First of all we should know what is /etc/localdomains and /etc/remotedomains.
/etc/localdomains:
list all the domains which is having local MX, that means mails are routing through our server.
/etc/remotedomains:
list all the domains that having remote MX, even if the website point to our server.
In some cases, we can see mail issues since the domain is added incorrectly for mail routing. ie, if a domain is using local MX but resides in /etc/remotedomains, then the mails will not be sent/recieved as exim doesn’t know how to handle the mails for this domain. In this case, we can use the below command to rebuild /etc/localdomains and /etc/remotedomains via SSH root user.
Access the server as root via SSH - If you don't know how, you can follow this guide.
Run the script below via SSH.
# /scripts/checkalldomainsmxs –yes
Congratulations! You've successfully rebuilt the /etc/localdomains
and /etc/remotedomains
files on your cPanel.
If you have any questions, please don’t hesitate to contact our team via live chat.
For technical inquiries, please feel free to reach our support team by emailing support@bigscoots.com from your registered email or by submitting a support ticket.