Jump to content

Disable PHP mail function in CWP – Control webpanel

Recommended Posts

In this tutorial we’ll learn how to disable php mail() function in CWP to block the users to be able to send spam emails or infected emails from php mail function. This will force users to use SMTP based email sending structure which is more secure and easily controllable upon the amount of mails they are sending i.e. you can add quota hourly basis in packages.

Run this below commands to disable php mail function completely :-

PHP switcher :

echo "disable_functions = mail" > /usr/local/php/php.d/disabled_function.ini  

PHP-CGI selector :

echo "disable_functions = mail" > /opt/alt/php53/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php54/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php55/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php56/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php70/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php71/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php72/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php73/usr/php/php.d/disabled_function.ini
echo "disable_functions = mail" > /opt/alt/php74/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php80/usr/php/php.d/disabled_function.ini 

echo "disable_functions = mail" > /opt/alt/php81/usr/php/php.d/disabled_function.ini  

echo "disable_functions = mail" > /opt/alt/php82/usr/php/php.d/disabled_function.ini   

PHP_FPM Selector :

echo "disable_functions = mail" > /opt/alt/php-fpm53/usr/php/php.d/disabled_function.ini && service php-fpm53 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm54/usr/php/php.d/disabled_function.ini && service php-fpm54 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm55/usr/php/php.d/disabled_function.ini && service php-fpm55 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm56/usr/php/php.d/disabled_function.ini && service php-fpm56 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm70/usr/php/php.d/disabled_function.ini && service php-fpm70 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm71/usr/php/php.d/disabled_function.ini && service php-fpm71 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm72/usr/php/php.d/disabled_function.ini && service php-fpm72 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm73/usr/php/php.d/disabled_function.ini && service php-fpm73 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm74/usr/php/php.d/disabled_function.ini && service php-fpm74 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm80/usr/php/php.d/disabled_function.ini && service php-fpm80 restart  

echo "disable_functions = mail" > /opt/alt/php-fpm81/usr/php/php.d/disabled_function.ini && service php-fpm81 restart 

echo "disable_functions = mail" > /opt/alt/php-fpm82/usr/php/php.d/disabled_function.ini && service php-fpm82 restart 


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...