CodeIgniter Forums
Loading Email Body From A File - 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: Loading Email Body From A File (/showthread.php?tid=2583)



Loading Email Body From A File - El Forum - 08-13-2007

[eluser]omed habib[/eluser]
Hey guys,

I'm trying to load the body of an email from an external file. I assumed the way to do this is this:
Code:
$this->load->library('email');        
$this->email->from('[email protected]', 'Sender');
$this->email->to('[email protected]');
$this->email->subject('Subject');

$emailbody = $this->load->view('contactus/emailtemplate');            
$this->email->message($emailbody);        

$this->email->send();

This doesn't work and only sends a blank email. Any ideas anyone?


Loading Email Body From A File - El Forum - 08-13-2007

[eluser]Seppo[/eluser]
try this

Code:
$emailbody = $this->load->view('contactus/emailtemplate',array(),true);



Loading Email Body From A File - El Forum - 08-13-2007

[eluser]omed habib[/eluser]
Worked perfect, thanks!