getEmail())) { $recoverPass = $user->setRecoverPass(); if (empty($_POST['captcha'])) { $obj->error = __("Captcha is empty"); } else { if ($user->save()) { require_once 'captcha.php'; $valid = Captcha::validation($_POST['captcha']); if ($valid) { //Create a new PHPMailer instance $mail = new \PHPMailer\PHPMailer\PHPMailer(); setSiteSendMessage($mail); //Set who the message is to be sent from $mail->setFrom($config->getContactEmail(), $config->getWebSiteTitle()); //Set who the message is to be sent to $mail->addAddress($user->getEmail()); //Set the subject line $mail->Subject = 'Recover Pass from ' . $config->getWebSiteTitle(); $msg = __("You asked for a recover link, click on the provided link") . " " . __("Reset password") . ""; $mail->msgHTML($msg); //send the message, check for errors if (!$mail->send()) { $obj->error = __("Message could not be sent") . " " . $mail->ErrorInfo; } else { $obj->success = __("Message sent"); } } else { $obj->error = __("Your code is not valid"); } } else { $obj->error = __("Recover password could not be saved!"); } } } else { $obj->error = __("You do not have an e-mail"); } die(json_encode($obj)); } else { ?>