In the aftersave() function I use swiftmailer to send a quick email to registrants. What I need to do is pass $this->id from the model that’s just been saved into the swift mail message view. So I can have a line like “hi subscriber number”.$id in the mail.
Could anybody quickly explain to a hack like me how this might be done and how to access a model’s attr from funky places.
understood. But how can I pass that value to swiftmailer, or it’s encapsulation mailer and drop it into a message? How to I send it outside of the aftershave() funktion?
$message = new Message;
$message->view = 'registrationFollowup';
//userModel is passed to the view
$message->setBody(array('someVar'=>$someVar), 'text/html'); //$someVar is now accessible from the view!
$message->addTo($userModel->email);
$message->from = Yii::app()->params['adminEmail'];
Yii::app()->mail->send($message);