2017-03-06 11 views
0

私はMessageControllerと呼ばれる私のcontollerのコードを次のようしている。ここでtempyii 1で電子メールテンプレートを電子メールに組み込む方法は?

 $letter = $this->renderPartial('temp'); 
     $message=$letter; 
     $mail = new YiiMailer('contact',array('message'=>$message,'name'=>'Message','description' => 'Message')); 
     $mail->setSubject('Message'); 
     $mail->setFrom('[email protected]', 'Company'); 
     $mail->setTo($_POST['useremail']); 

は、電子メールテンプレート($letter = $this->renderPartial('temp');)です。 メールテンプレートは読み込まれていません。 temp.phpmessageビューフォルダにあります。私の電子メールに電子メールテンプレートを含めるにはどうすればいいですか?

答えて

1

まず、renderPartial()の3番目のパラメータを "true" $this->renderPartial('temp', null, true);に設定して、レンダリング結果が返されないようにする必要があると思います。

関連する問題