这是我发送HTML电子邮件的代码,但它无法正常工作。只是原始的HTML代码显示在电子邮件中。
$emailID = $this->input->post('email');
$name = $this->input->post('name');
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['mailtype'] = 'html';
$config['crlf'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n";
$config['validate'] = FALSE;
$this->email->set_newline("\r\n");
$this->email->from($emailID,$name);
$this->email->to('vishvajitmahida009@gmail.com');
$this->email->subject('Email Testing');
$this->email->message('from clientside mail');
$this->email->send();
$message = $this->load->view('emailfile/file','',TRUE);
$this->load->library('email', $config);
$this->email->from($emailID,$name);
$this->email->to($emailID,$name);
$this->email->subject('Email Testing');
$this->email->message($message);
$this->email->send();
//echo $this->email->print_debugger();
答案 0 :(得分:1)
添加$this->email->initialize($config);
:
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['mailtype'] = 'html';
$config['crlf'] = "\r\n";
$config['wordwrap'] = TRUE;
$config['newline'] = "\r\n";
$config['validate'] = FALSE;
$this->email->initialize($config);