Php 使用'使用CodeIgniter发送电子邮件;邮寄';或';sendmail';

Php 使用'使用CodeIgniter发送电子邮件;邮寄';或';sendmail';,php,codeigniter,email,smtp,sendmail,Php,Codeigniter,Email,Smtp,Sendmail,我建立了一个内部网应用程序,需要发送电子邮件(低容量)。我将无法使用组织的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

我建立了一个内部网应用程序,需要发送电子邮件(低容量)。我将无法使用组织的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.
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
当我使用:

$config['protocol'] = 'mail';
我得到:

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.
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
有什么我应该在PHP中设置或签入
phpinfo()
来弄清楚如何让它工作吗?

好的-这很简单

对于任何面临这一问题的人:

  • 首先检查是否安装了sendmail(实际上是Postfix)。我正在使用Ubuntu11.x
  • cd-usr/sbin/

  • 如果找不到sendmail,则需要安装它
  • 我接受了对话框上的默认选项,一旦安装完成,电子邮件发送就不会出现问题

  • 在windows操作系统中,我尝试了sendmail类。
    您必须将sendmail.exe、sendmail.ini和其他两个.dll文件放入其中

    C:\wamp\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:\wamp\bin\apache\Apache2.2.17\bin

    现在运行您的项目,请参阅以下位置的日志文件:

    C:\wamp\sendmail\error.log C:\wamp\sendmail\debug.log


    我认为这篇文章可以帮助您..

    您是否尝试过不配置任何东西?这在大多数情况下都有效。如果这不起作用,那么我猜问题出在
    $config['mailpath']
    变量中。使用
    codeigniter电子邮件设置站点:stackoverflow.com
    进行谷歌搜索,看看现有的问题/答案是否对您有帮助。我一直在搜索解决方案,但到目前为止没有具体的解决方案-我只需要发送电子邮件,我发现的一切都建议建立一个可以发送和接收邮件的电子邮件服务器