CodeIgniter Forums
Load view as body for email? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Load view as body for email? (/showthread.php?tid=8286)



Load view as body for email? - El Forum - 05-13-2008

[eluser]harmstra[/eluser]
Hi all,

I'm trying to send a html-email, wich content is loaded from a view

Code:
$content    = $this->load->view('v_usn_order_email',$data,true);
....
....
....

$this->email->message($content);

This works fine, but every time i send an email, a new browser screen opens.
Is there a way to avoid this?


Load view as body for email? - El Forum - 05-13-2008

[eluser]Lone[/eluser]
The '$this->load->view()' section is loading the page not returning the data as you are expecting.

You need the save the content variable as a single string or you could just do an 'include()' to where the file with the content is located but you wont have the variables filled.


Load view as body for email? - El Forum - 05-13-2008

[eluser]harmstra[/eluser]
That's why I load a view, I need the vars in the view.
Any ideas?


Load view as body for email? - El Forum - 05-13-2008

[eluser]Sam Dark[/eluser]
Code:
$this->email->message($this->load->view('email/notification', $vars, true));



Load view as body for email? - El Forum - 05-13-2008

[eluser]harmstra[/eluser]
mm, not sure why, but doesnt work for me

Solved it with some ajax