Overview
The /etc/manualmx file in cPanel/WHM is used to override the default MX routing for specific domains. If a domain is listed in this file, Exim will use the manually specified mail exchanger instead of the domain's normal mail routing configuration.
An incorrect entry in /etc/manualmx can cause mail delivery failures, including errors such as:
R=manualmx T=remote_smtp
all hosts for 'example.com' have been failing for a long time
or
Connection timed out
SMTP timeout after initial connection
Before Making Changes
Always create a backup before modifying the file:
cp -a /etc/manualmx /etc/manualmx.bak
To review the current manual MX entries:
cat /etc/manualmx
Option 1: Remove a Single Domain
If only one domain has an incorrect Manual MX entry, remove it without affecting other domains.
Example:
sed -i '/^example\.com:/d' /etc/manualmx
Rebuild the Exim configuration:
/usr/local/cpanel/scripts/buildeximconf
systemctl restart exim
Option 2: Reset All Manual MX Entries
If your server does not intentionally use Manual MX routing for any domain, you can clear the entire file.
cp -a /etc/manualmx /etc/manualmx.bak
> /etc/manualmx
Rebuild Exim:
/usr/local/cpanel/scripts/buildeximconf
/usr/local/cpanel/scripts/updateuserdomains
/usr/local/cpanel/scripts/mailperm
systemctl restart exim
Verify Mail Routing
Confirm that the affected domain is configured as a Local Mail Exchanger if mailboxes are hosted on the cPanel server.
Check:
grep example.com /etc/localdomains
The domain should appear in the output.
Also verify it is not listed as a remote domain:
grep example.com /etc/remotedomains
No output should be returned for locally hosted mail.
Verify the Manual MX File
Ensure the domain has been removed:
grep example.com /etc/manualmx
No output indicates the Manual MX override has been removed.
Test Exim Routing
Verify how Exim routes mail after the change:
exim -bt [email protected]
If the domain is configured correctly, Exim should route the message locally instead of using the manualmx router.
Important Notes
-
Only clear
/etc/manualmxif none of your domains intentionally use an external mail provider such as Google Workspace, Microsoft 365, or Zoho Mail. -
If some domains use external mail services, remove only the incorrect entries rather than clearing the entire file.
-
Always back up
/etc/manualmxbefore making any modifications so the original configuration can be restored if necessary.
