Page 1 of 1

Disabling PHP mail

Posted: Fri Feb 07, 2014 8:59 pm
by David
What's the best way of disable outgoing mail completely to prevent any abuse?

Re: Disabling PHP mail

Posted: Sun Feb 09, 2014 7:22 pm
by skid
The best way is to stop mail server and remove it from autorun.

Code: Select all

# RHEL/CentOS

service exim stop
chkconfig exim stop

Code: Select all

# Debian/Ubuntu

service exim4 stop
update-rc.d exim4 disable

Re: Disabling PHP mail

Posted: Tue May 30, 2017 3:10 pm
by patstan
skid wrote:The best way is to stop mail server and remove it from autorun.

Code: Select all

# RHEL/CentOS

service exim stop
chkconfig exim stop
Although exim is off, i can still send mail with a php script.

Is there any way to disable this not just for one domain, but for all domains/users on the server? (global)

Re: Disabling PHP mail

Posted: Tue May 30, 2017 3:17 pm
by patstan
Ok i found an answer. Just simply rename exim.conf to something else. After that, phpmail will not work.

Re: Disabling PHP mail

Posted: Tue Jul 11, 2017 12:20 pm
by skurudo
There is another way for apache/httpd

Code: Select all

<Directory /dir/to/your/web/root>
...
        php_admin_value sendmail_path "tee mail.out > /dev/null"
...
    </Directory>