Welcome Guest, Not a member yet? Register   Sign In
Sending html email and using static template

Hi guys

I'm sending html mail w/o any trouble, using email library
Now, I'm need to add some design to the "newsletter" system I'm building with CI

Which would be the best location to store images, css, etc. for the email template (relative?, absolute?) to be used within the email library, and how should I do to use and replace variables like {sender_name}, {sender_message} in the view (html template)

Thanks a lot in advance Cool

I'd just create a view, and then use
PHP Code:
$data['image1'] = 'some_image.jpg';
$this->email->message($this->load->view('view_file'$dataTRUE)); //set the content of the email message to the rendered view 
to send dynamic data to the view and retrieve the rendered view file so you can output it in the email.

Being an email, the paths should be absolute. For the second problem, look at the great documentation: http://www.codeigniter.com/user_guide/li...email.html

Thanks guys!
All went fine. I loaded views with third param TRUE, put absolute paths, and all went great.
I had trouble using TTL/SSL but solved by using smtp only, but I guess that's a problem from server

$body contains the message and required the email-template.

Then you have to load the email library and the follwing to support HTML and send e-mail.


$this->email->from('[email protected]', 'From Name');
$this->email->to('[email protected]');


Theme © iAndrew 2016 - Forum software by © MyBB