使用codeigniter发送电子邮件时的主题长度问题

时间:2014-04-14 10:23:58

标签: php codeigniter

如果电子邮件的主题太长,则会出现以下错误

The following SMTP error was encountered:


451 See
http://pobox.com/~djb/docs/smtplf.html. Unable to send email using
PHP SMTP.  Your server might not be configured to send mail using
this method.

当缩短主题长度时,它工作正常。我smtp config设置为

$config['protocol'] = 'smtp'; $config['smtp_host'] = 'host';
$config['smtp_port'] = '**'; $config['smtp_user'] = $email_id;
$config['smtp_pass'] = $password; $config['charset'] = 'utf-8';
$config['newline'] = "\r\n"; $config['crlf']    = "\n"; 
$config['wordwrap'] = TRUE; $config['wrapchars'] = 10;
$config['mailtype'] = "html";

提前致谢。

1 个答案:

答案 0 :(得分:0)

显然这是一个已知问题,由电子邮件主题引起,超过75个字符: http://codeigniter.com/forums/viewthread/154493/P15/#925385

可能有助于更改电子邮件配置。有两种方法可以解决这个问题:

  1. 使用自己独立的配置参数创建电子邮件对象的单独实例:$email = new CI_Email(array('newline' => "\r\n"));
  2. 使用内联配置字符串:$this->email->newline = "\r\n";$this->email->crlf = "\n";