CodeIgniter Forums

Full Version: Loading Email Body From A File
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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?

El Forum

[eluser]Seppo[/eluser]
try this

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

El Forum

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