Welcome Guest, Not a member yet? Register   Sign In
Email Class - View as Message? [SOLVED]
#1

[eluser]Joakim_[/eluser]
Hi. Is it possible to use a view (with html) as the message for the Email Class?

I tried with no luck. This is how the code looks:

Code:
...

$config['mailtype'] = 'html';
$this->email->initialize($config);

$message = $this->load->view('summary');

$this->email->subject('Summary');
$this->email->message($message);

$this->email->send();

...

Thank you very much!
#2

[eluser]GSV Sleeper Service[/eluser]
have you tried this?
Code:
$message = $this->load->view('summary','',true);
adding 'true' as the third parameter to load->view will return the view as a string.
#3

[eluser]sharpe[/eluser]
You can pass also variables
Code:
$data['username'] = 'Joe';
$message = $this->load->view('summary',$data,TRUE);
#4

[eluser]Joakim_[/eluser]
Awesome, it works! Thank you very much! Smile




Theme © iAndrew 2016 - Forum software by © MyBB