我在使用codeignitor电子邮件类在codeignitor中发送带有附件的html邮件时遇到问题,邮件显示html代码而不是html视图。
我在下面的配置中将邮件类型设置为 html 是我的代码
$message="<p>test</p>";
$mail_to = "email@gmail.com";
$from_mail = $useremail;
$from_name = $userfname;
$reply_to = $useremail;
$subject = "Abstract Details";
$file_name = $datamail['varafile'];
$path = realpath('uploads/abstract');
// Read the file content
$file = $path.'/'.$file_name;
$config = array (
'protocol' =>'sendmail',
'mailtype' => 'html',
'charset' => 'utf-8',
'priority' => '1'
);
$this->load->library('email',$config);
$this->email->set_newline("\r\n");
$this->email->from($from_mail,$from_name);
$this->email->to($mail_to);
$this->email->subject($subject);
$this->email->message($message);
$this->email->attach($file);
if($this->email->send()){
echo "Mail send successfully";
}else{
echo "Error in sending mail";
}