我在使用codeignitor電子郵件類發送帶有附件的HTML郵件時出現問題,該郵件顯示的是html代碼而不是html視圖。下面當我使用codignator電子郵件類發送電子郵件時顯示html源的電子郵件
我已經設置mailtype在配置HTML是我的代碼
$message="<p>test</p>";
$mail_to = "[email protected]";
$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";
}
難道@Adam威斯布魯克回答你的問題?因爲你應該承認它。或者如果你想出來,你應該發佈你的解決方案。只是說,這就是它的工作原理。 –