public function actionSendinvite() { $email = $_REQUEST['email']; $name = Yii::app()->user->name; if (isset($_REQUEST['email'])) { $sub = new MemberSub(); $sub->name = "uknown"; $sub->email = $email; $sub->id_member = Member::model()->find("email = '{$name}' ")->id; $sub->date_invite = date('Y-m-d h:i:s'); $sub->status = 0; $sub->status_email = 0; if ($sub->save()) { Yii::import('ext.yii-mail.YiiMailMessage'); $message = new YiiMailMessage(); $message->view = "invite"; $params = array('email' => $email, 'name' => $name); $message->setBody($params, 'text/html'); $message->subject = "invitation for join vvfy"; $message->addTo($email); $message->from = Yii::app()->params['adminEmail']; if (Yii::app()->mail->send($message)) { $sub->status_email = 1; if ($sub->update()) { echo "succes"; } } else { echo "email invitation has not been sent"; } } else { // print_r($sub->getErrors()); echo CHtml::errorSummary($sub); // echo $sub->email; } } else { echo "requset not found"; } }