2012-07-25 92 views
3

我构建了需要发送电子邮件(低容量)的Intranet应用程序。我将无法使用我的组织的SMTP服务器,所以我需要通过sendmailmail发送这些电子邮件。使用'mail'或'sendmail'发送带有CodeIgniter的电子邮件

然而,当我配置我的电子邮件为:

$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()找出如何得到这个工作?

+1

你试过根本就没有配置什么?这大多数时候都有效。如果这不起作用,那么我猜测问题出现在$ config ['mailpath']'变量中。 – Robert 2012-07-25 15:21:37

+0

使用'codeigniter电子邮件设置网站:stackoverflow.com'做一个谷歌搜索,看看现有的任何问题/答案是否有帮助。 – 2012-07-25 15:23:16

+0

我一直在寻找解决方案,但目前为止没有具体的东西 - 我只需要发送电子邮件,我发现的一切都建议构建一个可以发送和接收的电子邮件服务器 – pepe 2012-07-25 15:26:11

回答

10

好的 - 这很简单。

对于任何人谁面临这个问题:如果安装的sendmail(实际上后缀)

  1. 首先检查。我使用的是Ubuntu 11.x.

CD usr/sbin目录/

  1. 如果你不能找到sendmail的,那么就需要安装
sudo apt-get install postfix 
  1. 我接受d对话框上的默认选项,一旦安装完成,发送的电子邮件没有问题。
1

在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 
[email protected] 
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的\错误。登录 C:\ WAMP \ sendmail的\

的debug.log

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

相关问题