Ошибка в содержании почты с использованием SMTP в codeigniter
На самом деле моя почта отправляется с тегами 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, все работает нормально. В чем моя ошибка?
$config = array(
'protocol' => 'mail', // 'mail', 'sendmail', or 'smtp'
'smtp_host' => 'your host name',
'smtp_port' => 465,
'smtp_user' => 'example@example.com',
'smtp_pass' => 'password',
'smtp_timeout' => 5,
'wordwrap' => TRUE,
'wrapchars' => 76,
'mailtype' => 'html',
'charset' => 'utf-8',
'validate' => TRUE
);
$this->load->library('email', $config);
$htmlContent = '<h1>Sending email via SMTP server</h1>';
$htmlContent .= '<p>This email has sent via SMTP .</p>';
$this->email->to('receiver@example.com');
$this->email->from('sender@domain.com','mywebsite');
$this->email->subject('How to send email via SMTP server in CodeIgniter');
$this->email->message($htmlContent);
$this->email->send();