How to disable the php mail() function on cPanel with CloudLinux?

If your server installed cPanel with CloudLinux along alt-php and you want to disable php mail() function for one domain, then you can do this using the following steps :

1. Logged into your server via SSH and Edit /etc/cl.selector/php.conf file.

2. Add below lines at the top of this file:

Directive = sendmail_path
Default = /usr/sbin/sendmail -t -i
Type = list
Range = /usr/sbin/sendmail -t -i,/bin/true
Comment = Switch to /bin/true to disable php mail

3. Then, logged into client's cpanel, change the sendmail path to /bin/true using "Select PHP Version > Switch to PHP Settings".

The account will no longer be able to send via php mail.

Enjoy and let me know your thoughts on this article.

Was this answer helpful?

 Print this Article

Also Read

pcre.backtrack_limit reached - Joomla issue

I was getting the below error on my Joomla website - pcre.backtrack_limit reached. Solution :You...

How to Install or Uninstall EasyApache 4 on cPanel server?

EasyApache Software is included within your cPanel and WHM license which is very easy and useful...

How to Specify the exact time to run a backup on cPanel server?

How to Specify the exact time (hour) to run a backup on cPanel server? Solution :- By default,...

How to setup SMTP port on Linux server using WHM?

By default SMTP outgoing server is configured for port 25. If you would like to allow exim to...

Failed: Account Restore Failed: “clean: Cannot cleanup top level directory:

While restoring the full cPanel backup file in 'tar.gz' format from WHM >> Backup >>...

Powered by WHMCompleteSolution