Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
186 views
in Technique[技术] by (71.8m points)

php - PHPMailer Function Issue

I have problem with my php mailer was not Working & But token Was created. Just showing msg 'Something Went to wrong'...Please Help me to Find Problem My Code:

if(isset($_POST['action']) && $_POST['action'] == 'forgot'){
    $email = $user->test_input($_POST['email']);

    $user_found = $user->currentUser($email);

    if($user_found != null){
        $token = uniqid();
        $token = str_shuffle($token);

        $user->forgot_password($token,$email);
        try{
            $mail->isSMTP();
            $mail->Host = 'smtp.gmail.com';
            $mail->SMTPAuth = true;
            $mail->Username = Database::USERNAME;
            $mail->Password = Database::PASSWORD;
            $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;
            $mail->Port = 587;

            $mail->setFrom(Database::USERNAME,'HuntedZone');
            $mail->addAddress($email);

            $mail->isHTML(true);
            $mail->Subject = 'Reset Password';
            $mail->Body = '<h3>Click the Below link to reset your password.<br><a href="http://localhost/user-system/reset-pass.php?email='.$email.'&token='.$token.'">http://localhost/user-system/reset-pass.php?email='.$email.'&token='.$token.'</a><br>Regards<br>HuntedZone!</h3>';

            $mail->send();
            echo $user->showMessage('success','We Have send you the reset link in your e-mail ID, Please Check your e-mail');
        }catch(Exception $e){
            echo $user->showMessage('danger','Something went wrong Please try again Later!');
        }

    }else{
        echo $user->showMessage('info','This E-mail is not Registered!');
    }
}
question from:https://stackoverflow.com/questions/65643949/phpmailer-function-issue

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...