Hi guys. I am facing a problem, if anyone knows the solution then please share the solution.
I have set the Member model in my project i.e. user can register in the site. and then their registration will be approved by the admin. and when the admin approves their registration then a confirmation email should be sent to his/her email.
I have set the update action of the member controller as follows.
public function actionUpdate($id) {
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Members'])) {
$model->attributes = $_POST['Members'];
if ($model->save()) {
if ($model->is_confirmed == '1') {
$email = "$model->email";
$subject = 'Account Approval';
$body = "Your account is now approved. Please visit us.";
mail($email, $subject, $body);
}
$this->redirect(array('admin'));
}
}
$this->render('update', array(
'model' => $model,
));
}
but the email is not sending to the user. and also doesn’t show any error.
If anyone knows the solution then please share.
Thanks in advance.