This has to be simple, I’m trying to load a view file as my email message using CodeIgniter. The point is to have an HTML and not just a text-based message.
Currently, my emails are sending ok but the messages are empty if my code looks like what it does below:
Here’s the relevant part of the php:
$config=array(
'protocol' => 'smtp',
'smtp_host' => 'xxx',
'smtp_user' => 'xxx',
'smtp_pass' => 'xxx',
'smtp_port' => 587,
'mailtype' => 'html',
'crlf' => "\r\n",
'newline' => "\r\n"
);
$this->email->initialize($config);
$this->email->subject('testing loading a view file');
$msg = $this->load->view('reviews/email', '', false);
$this->email->message($msg);
Here’s what the reviews/email.php file looks like:
<html>
<head></head>
<body> <h1>this should be BIG</h1> this should not
<a href="http://google.com/<? $php='login'; echo $php?>">Google</a>
</body>
</html>
Thanks for any advice you might have,
Tim
You’re loading the view incorrectly. The third parameter is supposed to be
TRUEso that CodeIgniter will return the view as a string.From http://codeigniter.com/user_guide/general/views.html: