提问人:Vasu Sharma 提问时间:12/31/2021 更新时间:12/31/2021 访问量:59
Codeigniter - 使用 HTML 类型时发送电子邮件时出错
Codeigniter- Error while email send when using HTML type
问:
我发现自己遇到了一个小问题。我正在使用 codeigniter 并使用 HTML 查看器处理邮件功能,但是当我发送邮件时,它的响应为 true,但它没有进入邮箱。
我的代码是: in Admin
function sendEmail($to='',$subject='',$message, $fileUrl=''){
$data['header']=$message[0];// Name
$data["message"]=$message[1];// Message in Text
$data['image']=base_url()."assets/images/App-icon.jpg"; //logo
$body = $this->load->view('emailtemplete',$data,TRUE);
$from = "[email protected]";
$this->load->library('email');
$config['wordwrap'] = false;
$config['mailtype']='html';
$config['charset'] = 'utf-8';
$config['priority'] = '2';
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->from($from);
$this->email->to($to);
//$this->email->bcc($to);
$this->email->bcc('[email protected]');
$this->email->subject($subject);
$this->email->message($body,true);
if(!empty($fileUrl))
{
$this->email->attach($fileUrl);
}
$r=$this->email->send();
if(!$r){
print_r($this->email->print_debugger());
}
}
而 emailtemplete.php 是
<html></body>
<div><img src="<?php $image; ?>"></div><br/>
<div>Dear <?php $header ;?></div><br/>
<div><?php $message; ?></div>
</body</html>
我在哪里犯了错误。当邮件类型为文本时,此代码工作正常,但当它是 HTML 时,则无法接收。
答: 暂无答案
评论