Regarding HTML EMAIL genereation?

Hi Everyone,

I would like to generate automatic emails. But I would like to format it in a proper way with logo and colors etc…

I am requesting you to provide a suggestion that is there any extension which can manage templates? or is there any place that I can learn doing email templates?

Could anyone please suggest?

this extension is what I use, its perfect for what you want

Hi Gustavo,

Thank you for the advice. I installed email extension as you suggested. Normal mail its working fine. But I tried to create a view in email/views/myview.php . When I run the app, I am getting error saying controller can’t find the view.

And one more query, Can I add images to this view?

Could you please help me with this?

As you already implemented it. If you can provide me example code, that would be a great help.

Thank you in advance.

Yes, you can by using the full path (www.domain.com/image/path.jpg)

You are probably pointing it wrongly.

Is it a module ? If yes do it like :


$mail->body=$this->renderPartial('/myView');

the above will look under protected/{module}/views/myView.php

if not something like this:


$this->renderPartial('//email/myView');

//or just 

$this->renderPartial('myView');



and that will look under /protected/views/{controller}/myView.php

use renderPartial also because you dont need to register JS

if you need a layout specify in the view do like this:




//view code

$this->beginContent('/layouts/myLayout',array('layoutVar1'=>'value1'));

//view code

$this->endContent();



I dont have any code here, I used it a while ago, but understand the above will make it work just fine

Thank you Gustavo…

I appreciate your time.

But unfortunately its not working for me.

I forgot to mention that the rendered page must be returned instead of outputed, turning on the 3rd parameter, like:




$this->renderPartial('email',array('model'=>$model),true);



Why it doesn’t work ? Whats the output ? or the error ?