SMTP Codeigniter电子邮件错误'354结束数据。

时间:2012-11-07 14:34:31

标签: codeigniter email smtp

我无法让Codeigniter电子邮件库在新服务器上运行。

此代码之前曾有过工作,但最近已停止工作,我不能为我的生活找出原因。基本上,这是代码:

 $this->email->from('example@example.com', 'Intranet');
 $this->email->to($c['email']);//This is def a valid email

 //$name is being obtained from elsewhere

 $this->email->subject('Time manager reminder');
 $this->email->message("
   {$name[0]},
   <br/><br/>You haven’t completed your time for today. Please don’t forget to do so<br/><br/>
   Intranet
  ");

 $this->email->send();

和email.php配置密码

$config['mailtype'] = "html";
$config['priority'] = 1;
$config['protocol'] = "smtp";

$config['smtp_host'] = "my server..";
$config['smtp_user'] = "u/n";
$config['smtp_pass'] = "p/w";

$config['smtp_timeout'] = 1;
$config['validate'] = true;

我从$this->email->print_debugger();收到的错误如下:

data: 354 End data with .

The following SMTP error was encountered: 
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this   method.

您可以在http://pastebin.com/y9UeaEGY

上查看有关pastebin的完整错误

我已经删除了所有地方的电子邮件,但我可以向您保证这些电子邮件是有效的并使用了电子邮件地址。

我很感激您提供的任何帮助。感谢

1 个答案:

答案 0 :(得分:2)

我发现了原因。显然,在配置中,您需要设置

$config['crlf']     = "\r\n";
$config['newline']  = "\r\n";

手动在email.php文件中。 Codeigniter默认情况下似乎没有这样做。奇怪:))