Where does cPanel store a domain's mail routing selection (automatic/local/remote/backup)?

Valetia

Well-Known Member
Jun 20, 2002
216
10
168
cPanel Access Level
Root Administrator
In which file(s) does cPanel store a domain's mail routing selection (automatic/local/remote/backup) as chosen by the user in cPanel?
 

MilesWeb

Well-Known Member
PartnerNOC
May 23, 2012
173
2
68
India
cPanel Access Level
Root Administrator
Twitter
In which file(s) does cPanel store a domain's mail routing selection (automatic/local/remote/backup) as chosen by the user in cPanel?
With the automatic option it will detect where MX records point and will update it accordingly.

/etc/backupmxhosts - backup
/etc/localdomains - local
/etc/remotedomains - remote

Hope this helps :)
 

Valetia

Well-Known Member
Jun 20, 2002
216
10
168
cPanel Access Level
Root Administrator
/etc/backupmxhosts - backup
/etc/localdomains - local
/etc/remotedomains - remote
Yes, these are the final files generated by cPanel's mail routing processor, but we need to know where cPanel stores the user preference.

For example, if a user sets the preference in cPanel to 'Local' (instead of 'Automatic', 'Remote' or 'Backup'), cPanel will need to store this user preference somewhere, while also updating the /etc/localdomains file.

Then, the next time the user returns to cPanel, they will continue to see 'Local' selected, and not 'Automatic (Local)'.

So, what we need to know is where cPanel stores this data. :)
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Hello :)

It's configured in the cPanel user file (e.g. /var/cpanel/users/$username). EX:

Code:
MXCHECK-testdomain01.com=secondary
Thank you.
 

Valetia

Well-Known Member
Jun 20, 2002
216
10
168
cPanel Access Level
Root Administrator
Thanks! We see the MXCHECK entries in /var/cpanel/users/$username.

But, it looks like running /scripts/checkalldomainsmxs will remove all of those MXCHECK entries in /var/cpanel/users/$username!

In other words, running that script will reset all domains on the server to 'Automatic', even if a user had selected something different.

Is this intentional, or a bug?

If it is a bug, please look into correcting the issue.

On the other hand, if it is intentional, then please perform the following:

1. Add a warning message to /scripts/checkalldomainsmxs that it will reset all domains to 'Automatic', overriding cPanel users' preferences!

2. Add an optional argument (such as --preserve-user-settings) that allows it to preserve (and honor) the users' preferences. This also speeds up the processing for domains that have user selections.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,913
2,203
363
Please notice the following warning when running this script:

[~]# /scripts/checkalldomainsmxs
This script will check each MX entry for every domain configured on this machine.

The MX record will be determined from the zone file associated with this server,
not from a remote query of the DNS record. If you are using and editing the zone
file on a server not associated with this server through a DNS cluster configuration,
then this utility will configure your email settings incorrectly.

This utility updates the following files which alter the local delivery and sending
methods of email:

/etc/localdomains
/etc/remotedomains
/etc/secondarymx

As a safety precaution you must run this utility with the argument "--yes" to proceed.
example:
/scripts/checkalldomainsmxs --yes
We don't generally advise running the "/scripts/checkalldomainsmxs" script. Is there some tutorial or guide that suggested using it?

Thank you.