I have a problem in sending html mail with attachment in codeignitor using codeignitor email class the mail showing html code instead of html view.
i had set the mailtype as html in config below is my code
$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("
");
$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";
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…