Reputation: 33
This is my code to send HTML email but its not working properly. Just raw html code is shown in the email.
$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('[email protected]');
$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();
Upvotes: 3
Views: 343
Reputation: 7666
Add $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);
Upvotes: 1