0
У меня возникла проблема с отправкой html email codeigniter. Для текста это нормально, но при стилизации с помощью html он всегда отображает код. Искал много и изменил, что элементы массива электронной почты для многих. Но приводит к тому же html-коду. Пожалуйста, помогите мне ..Отправка html сообщений электронной почты в виде кода в codeigniter
вот моя функция контроллера
public function contact_process()
{
$name=$this->input->post('txt_name');
$phone=$this->input->post('txt_phone');
$from_email=$this->input->post('txt_email');
$message=$this->input->post('txt_message');
$config = Array(
'protocol' => 'sendmail',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => 'my_email[email protected]',
'smtp_pass' => 'my_password',
'mailtype' => 'html',
'charset' => 'utf-8',
'priority' => '1',
'wordwrap' => 'true'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$to_email = '[email protected]';
$subject = "Product Request Mail";
$body = "<html>
<head><title>Best Price</title></head>
<body>
<div style='max-width: 800px; margin: 0; padding: 30px 0;'>
<table width='80%' border='1' cellpadding='0' cellspacing='0'>
<tr>
<td width='5%'></td>
<td align='left' width='95%' style='font: 13px/18px Arial, Helvetica, sans-serif;'>
<h2 style='font: normal 20px/23px Arial, Helvetica, sans-serif; margin: 0; padding: 0 0 18px; color: black;'>Contact Mail</h2>
<br />
<big style='font: 16px/18px Arial, Helvetica, sans-serif;'> Name : '.$name.'</big><br />
<big style='font: 16px/18px Arial, Helvetica, sans-serif;'> Phone : '.$phone.'</big><br />
<big style='font: 16px/18px Arial, Helvetica, sans-serif;'> Email : '.$from_email.'</big><br />
<big style='font: 16px/18px Arial, Helvetica, sans-serif;'> Message : '.$message.'</big><br />
</td>
</tr>
</table>
</div>
</body>
</html>";
//send mail
$this->email->from($from_email, $name);
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->message($body);
//echo $this->email->send();
//echo $this->email->print_debugger();
if ($this->email->send())
{
redirect('user/bestprice/contact/', 'refresh');
}
else
{
redirect('user/bestprice/contact/', 'refresh');
}
}
Я думал 'mailtype' => 'HTML' в массиве конфигурации достаточно. Спасибо @Abdulla – Prasanth