我构建了一个需要发送电子邮件(低容量)的Intranet应用程序。我将无法使用组织的SMTP服务器,因此我需要通过sendmail
或mail
发送这些电子邮件。
但是,当我将电子邮件配置为:
$config['protocol'] = 'sendmail';
我明白了:
Exit status code: 127
Unable to open a socket to Sendmail. Please check settings.
Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.
当我使用时:
$config['protocol'] = 'mail';
我明白了:
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
我是否应该在PHP中设置任何内容或签入phpinfo()
以确定如何使其工作?
答案 0 :(得分:10)
好的 - 这很简单。
对于任何遇到此问题的人:
cd usr / sbin /
sudo apt-get install postfix
答案 1 :(得分:1)
在windows os中,我尝试过sendmail类 你必须把sendmail.exe,sendmail.ini和其他两个.dll文件放在里面,
C:\瓦帕\ sendmail的
为gmail服务器配置sendmail.ini文件:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=tls
error_logfile=error.log
debug_logfile=debug.log
auth_username=mymail@gmail.com
auth_password=mypassword
hostname=smtp.gmail.com
然后编辑你的php.ini文件,该文件在
中可用C:\瓦帕\ BIN \阿帕奇\ Apache2.2.17 \ BIN
sendmail_path="C:\wamp\sendmail\sendmail.exe -t -i"
现在运行您的项目,请参阅以下日志文件:
C:\瓦帕\ sendmail的\ error.log中 C:\瓦帕\ sendmail的\的debug.log
我认为这篇文章可以帮助你..