So I’m trying to send out an email, $resend validations check if the email is in the database.
The problem I’m getting is $resend->email is being populated, like its empty or NULL. and the email isn’t being sent out,
however if I hard code the email $signUpEmail->addTo(‘me@google.com’); then it works fine. So somehow $resend->email is not being saved from the form or something.
Here is the code
public function actionVerify()
{
$model = new VerifyForm;
$resend = new ResendForm;
$this->performAjaxValidationTwo(array($model,$resend), 'verify-form');
if(isset($_POST['VerifyForm']))
{
$model->attributes=$_POST['VerifyForm'];
$resend->attributes=$_POST['VerifyForm'];
if(!$resend->hasErrors())
{
$signUpEmail = New YiiMailMessage;
//$signUpEmail->view = 'signup';
//$signUpEmail->setBody(array('model'=>$model), 'text/html');
$signUpEmail->setFrom(array('welcome@notesforus.com' => 'Notes For Us'));
$signUpEmail->setSubject('Welcome - Notes For Us');
$signUpEmail->addTo($resend->email);
Yii::app()->mail->send($signUpEmail);
}
$this->render('verify',array(
'model'=>$model,
'resend'=>$resend,
));
}
}