在 codeigniter 中使用 SMTP 的邮件内容出错实际上,我的邮件是用 HTML
标签发送的,它显示的是 HTML
标签不正确。
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'user@gmail.com',
'smtp_pass' => '',
'mailtype' => 'html',
'charset' => 'utf-8',
'wordwrap' => TRUE
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$email_body ="<div>hello world</div>";
$this->email->from('user@gmail.com', 'ddd');
$list = array('user@gmail.com');
$this->email->to($list);
$this->email->subject('Testing Email');
$this->email->message($email_body);
$this->email->send();
echo $this->email->print_debugger();
如果我在不使用 SMTP 的情况下发送邮件,它工作正常。我的错误是什么?
原文由 user1182623 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以尝试将邮件类型设置为
HTML
的这行代码: