简体   繁体   English

在自定义exim安装中使用php mail()函数

[英]Use php mail() function with custom exim installation

I have an exim installation in a non-standard path. 我在非标准路径中安装了exim。

How can I configure php so that mail() will use it? 如何配置php,以便mail()使用它?

The solution is to change the value of the "sendmail_path" variable in php.ini: 解决方案是更改php.ini中“ sendmail_path”变量的值:

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

exim is compatible to sendmail when it comes to command line arguments 在命令行参数方面,exim与sendmail兼容

After guarantee that exim4 is really running without any problem. 保证exim4确实在运行时没有任何问题。

sudo service exim4 status
or 要么
 sudo /etc/init.d/exim4 status sudo /etc/init.d/exim4状态 
Note .: Pay attention to result at the command line. 注意 。:注意命令行结果。 It'll warn you, if it has any problem. 如果有任何问题,它将警告您。

\n * Stopping MTA for restart *停止重新启动MTA\n * Restarting MTA *重新启动MTA\nALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken 警报:exim paniclog / var / log / exim4 / paniclog具有非零大小,邮件系统可能损坏\n

You may edit the file 您可以编辑文件

 /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini 
and add the line 并添加线
 sendmail_path = "/my_custom_path/exim -t" sendmail_path =“ / my_custom_path / exim -t” 
without the option -i which will cause problems. 没有选项-i 会导致问题。

So, type that to test, 因此,请输入进行测试,

 echo "Testing." 回显“测试”。 | | mail -s Test example@gmail.com 邮件-s测试example@gmail.com 
instead of test with PHP function. 而不是使用PHP函数进行测试。 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. 有太多东西(防火墙,网络:子网和安全组,PHP设置)会给您的例程造成问题,从而可以更好地保证exim4正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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