Mailer component

Is there any plan to create a mailer component for Yii? If not, I’m making that request now.

If you plan to to it, i think it would be quite useful if it able to make use of views. here’s a quick example.

say i have a user registration action where i want to send an email to the user when they successfully register, i could have a file (eg: register.php) under a directory like /protected/views/mail with contents like:




Hello <strong><?php echo $model->username; ?></strong>, you have successfully registered. To confirm your registration, click <?php echo CHtml::link('Here',array('/site/vaidate','code'=>'code')); ?>.



to send the email to the user.

we could do some thing like this:




if($model->save())

{

   $mailer = Yii::app()->mailer;

   $malier->addRecipient($model->email);

   $mailer->render('register',array('$model'=>$model))->send();// send would return boolean so you can check status.

}   



The component would have attributes to set the view path, the type of views to use eg: .txt, .php/html

if .txt then mail will be plain text.

I have more ideas that could be used in a component like that, if you are interested, let me kno and i will compile and post them.

Look in that extensions: http://www.yiiframew…tensions/?cat=9

There is also Marko’s SwiftMailer component.

http://blog.mbischof.de/swiftmailer-as-a-capplicationcomponent

I’m already using my mail component which implements phpmailer but who wouldn’t rather an official mail component from Qiang?

My email component supports views

http://www.yiiframework.com/extension/email

However the implantation is not that great (mainly it uses php’s mail() function only, which is bad for many reasons I hear). I am going to rewrite it to be a wrapper for swiftmailer hopefully pretty soon

http://swiftmailer.org/

Hi there, I want to use your swift mailer here - but how do you install it? Please help!