Welcome Guest, Not a member yet? Register   Sign In
Send HTML email but showing souce code ?
#1
Exclamation 

:huh:
I dont know my wrong, but when send email HTML using showing as source code.

Please help me

my code :


Code:
$config = array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => $sender_email,
'smtp_pass' => $user_password,
'mailtype' => 'html',
'wordwrap' => TRUE,
'charset' => 'iso-8859-1',
'newline' => '\r\n'
);

$this->load->library('email', $config);

$this->email->from($sender_email, $sender_name);
$this->email->to($to_email);
$this->email->subject($subject_mail);
$body = $this->load->view('email',null,TRUE);

$this->email->message($body);
if (!$this->email->send()){
echo 'fail to load email';
}
else {
echo 'success to send email';
}
Reply
#2

Try this, change
PHP Code:
$this->load->library('email'$config); 
with
PHP Code:
$this->load->library('email');
$this->email->initialize($config); 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB