Hi, everyone.
I am using yii-user and yii-mail/mailer…
mailer:http://www.yiiframework.com/extension/mailer/
mail: http://www.yiiframework.com/extension/mail
I know that there is a way to customize the email you send to the user, for example, After you sign up, you can receive an "activation code" from my website via email.
And I want to customize that email now…
Here is the code in my registration controller:
if ($model->save()) {
$profile->user_id=$model->id;
$profile->save();
if (Yii::app()->controller->module->sendActivationMail) {
$activation_url = $this->createAbsoluteUrl('/user/activation/activation',array(
"activkey" => $model->activkey, "email" => $model->email));
UserModule::sendMail($model->email,UserModule::t(
"Thank you for your registration at {site_name}",array('{site_name}'=>Yii::app()->name)),
UserModule::t("Please activate your account here {activation_url}",array('{activation_url}'=>$activation_url)));
}
Those are some codes from the yii-user 's registration controller. (part about email)
So how should I combined the mailer extension with this??
$message = new YiiMailMessage;
$message->view = 'registrationFollowup';
//userModel is passed to the view
$message->setBody(array('userModel'=>$userModel), 'text/html');
$message->addTo($userModel->email);
$message->from = Yii::app()->params['adminEmail'];
Yii::app()->mail->send($message);
Where should I put those codes…?
And how should I modify my view?
Any hints would be very, very helpful.
Thanks!!!!