Question 1: How can I disable the mail service of a domain on a cPanel/WHM server?
To stop only the mail service without stopping the website, follow these steps:
-
Connect to the server as root via SSH.
-
/etc/localdomainsOpen this file and remove the domain whose mail service you want to disable. -
/etc/remotedomainsOpen this file and add the same domain to it.
This stops mail processing for that domain on your server, while the website keeps running.
Question 2: What are the benefits of this?
-
For sites that have moved their mail service to another company, it prevents unnecessary mail traffic on your server.
-
It prevents email accounts with weak passwords from being abused by malware.
-
It keeps your server IP address off spam blacklists.
Question 3: Do I need to restart any service afterwards?
No, /etc/localdomains and /etc/remotedomains changes take effect immediately; you do not need to restart Exim or any other service.
Question 4: What else can I do to make the server more secure?
-
Enable the SMTP Restrictions feature in WHM.
-
Use a firewall (for example CSF) to open the outgoing SMTP ports only to trusted IPs.
-
Strengthen mail authentication by correctly configuring SPF, DKIM ve DMARC records in DNS.
