How To Use Begincontent() To Apply A Template Around An Email Message That Is Delivered

I’ve reported an issue I met in Yii, see this ticket: https://github.com/y...yii/issues/1383

Now I am looking to some alternatives or workaround to get a template applied to a email layout (header, footer). Be aware that I am in a console application.

I’ve started the view render like this




$mail->Body = CController::renderInternal(Yii::app()->basePath . '/views/email/onNewAdminUser.php', array('model' => $model, 'sender_name' => $sender_name), true);



Please post your ideas for discussion.

I’m using renderFile in console apps for this purpose.

That helps, but how do you assign a layout to your email?

We have solved it using a web controller that does email rendering, with restrictions, and we call from commands this controller using CURL.