I'm trying to send a HTML e-mail using codeigniter but when I check my inbox using GMail the message is blank. Why is it doing this?
I have checked similar questions but none seem to provide an answer that worked.
This is my controller:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Email extends CI_Controller {
public function index()
{
$message = $this->load->view("email/default_view",True);
$email_config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => '465',
'smtp_user' => '****************',
'smtp_pass' => '****************',
'mailtype' => 'html',
'starttls' => true,
'newline' => "
"
);
$this->load->library("email",$email_config);
$this->email->from('*******', '*********');
$this->email->to('********');
$this->email->subject("Re: Contact");
$this->email->message($message);
$this->email->send();
echo $this->email->print_debugger();
}
}
And my view:
<html>
<body>
<h2>Some text</h2>
</body>
</html>
I get no errors from "print_debugger()" and the message appears as expected.