我内置需要发送电子邮件(低量)内联网应用。 我不能用我的组织的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()
来找出如何得到这个工作?
OK - 这很简单。
对于任何人谁面临这个问题:
- 首先检查是否安装sendmail的(实际上后缀)。 我使用Ubuntu 11.x的
CD usr / sbin目录/
- 如果你不能找到sendmail的,那么就需要安装
sudo apt-get install postfix
- 我接受了对话框中的默认选项,并一次安装是没有问题发完,电子邮件。
在Windows操作系统中,我已经试过sendmail的类。
你必须把sendmail.exe,sendmail.ini,和另外两个.dll文件里面,
C:\ WAMP \ sendmail的
配置sendmail.ini文件按照Gmail服务器:
[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:\ WAMP \ BIN \ apache的\ Apache2.2.17 \ BIN
sendmail_path="C:\wamp\sendmail\sendmail.exe -t -i"
现在运行项目,请参阅日志文件:
C:\ WAMP \ sendmail的\ error.log中C:\ WAMP \ sendmail的\的debug.log
我觉得这篇文章可以帮助你..