How to disable PHPMail in a cPanel account with CloudLinux

In managing a server, of course, we will be faced with various problems that exist. A very dangerous and frequent problem is the use of spam caused by web clients, whether it is intentional or unintentional. We will provide a guide on how to disable the phpmail feature on a cPanel account by using the PHP Selector feature on Cloudlinux.

Jump to the guide, as follows:

1. Login to SSH/Terminal Server.

2. Edit the /etc/cl.selector/php.conf file or run the following command


3. Add the following code on the top line.


4. Save 


The next step is to disable through the cPanel account. 


1. Login to the cPanel of the destination account.

2. Enter the Select PHP Version menu.



3. Choose the PHP version but not the native version.

4. If it has been replaced, please click the Switch To PHP Options menu on the right.



5. Next, please change the options in the sendmail_path section as shown below.



6. Save. 

After saving, users cannot send emails via php but can send using cPanel webmail or SMTP mode.

Good luck.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.