PDA

View Full Version : WHM/cPanel - Preventing PHP scripts to send e-mail



Fli
03-20-2018, 09:31 AM
As for preventing PHP from sending email, you can enable a setting in WHM that prevents anything from sending email without going through Exim, but there is no bounceback to it, it just fails. To do this, access WHM as root and navigate to Server Configuration >> Tweak Settings >> Mail (tab) and enable 'Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)'.

Another way is to disable "mail" functions in global php.ini file:
$ whereis php.ini

On WHM/cPanel server it is /usr/local/lib/php.ini

the variable to edit is:

disable_functions = "exec, mail"

After saving changes, no need to restart apache.