简体   繁体   中英

Use php mail() function with custom exim installation

I have an exim installation in a non-standard path.

How can I configure php so that mail() will use it?

The solution is to change the value of the "sendmail_path" variable in php.ini:

sendmail_path="/my_custom_path/exim -t -i"

exim is compatible to sendmail when it comes to command line arguments

After guarantee that exim4 is really running without any problem.

sudo service exim4 status
or
 sudo /etc/init.d/exim4 status  
Note .: Pay attention to result at the command line. It'll warn you, if it has any problem.

\n * Stopping MTA for restart \n * Restarting MTA \nALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken \n

You may edit the file

 /etc/php5/apache2/php.ini  
and add the line
 sendmail_path = "/my_custom_path/exim -t"  
without the option -i which will cause problems.

So, type that to test,

 echo "Testing."  |  mail -s Test example@gmail.com  
instead of test with PHP function. There are so many things (firewall, network: subnets and security groups, PHP settings) that can cause problems to your routine that's better guarantee exim4 works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM