styling output of emailing |
[eluser]brian88[/eluser]
So I use the typical email code like this Quote:if( $this->input->post() ){ And you get an email plain and simple Name: yourname Email: [email protected] Message: your message... Is there anyway to style this output better so it looks better on an email client such as gmail?
[eluser]Matalina[/eluser]
send as html and use html to format. You'll have to change the config of the email library to send html. http://ellislab.com/codeigniter/user-gui...email.html check email preferences to set up the config file.
[eluser]rip_pit[/eluser]
the email lib can use views as "template". So first prepare an html template in the views like this /application/views/email_tpl_html.php Code: <html> Then load it with something like : Code: $view_data = array('sitename'=>'My website','siteurl'=>'mysite.com');
[eluser]mact1079[/eluser]
Any idea why I would get this error? When I have the template in views/email_templates/welcome.php? Severity: 4096 Message: Object of class CI_Email could not be converted to string Filename: libraries/Email.php Line Number: 383 Code: $data = array('sitename'=>'Welcome','siteurl'=>'mydomain.com'); This is the content of welcome.php Code: <html>
[eluser]xerobytez[/eluser]
Change the code on line 2 from. Code: $message = $this->email->message($this->load->view('email_templates/welcome', $data, TRUE)); to: Code: $message = $this->load->view('email_templates/welcome', $data, TRUE);
[eluser]mact1079[/eluser]
Wow. I'm an idiot. Seriously sorry for wasting your time on that one! |
Welcome Guest, Not a member yet? Register Sign In |