I've got a problem, made reset password button but it wont send mail back.
I do have PHP mailer included, don't know why it wont send.
BTW before send I made query to check in DB for validation,that is working fine but just won't send ?!
Any suggestion ? no minuses -_-
$to = $userEmail;
$subject = 'Reset your password ,regards!';
$message = '<p>We recieve a password request</p>';
$message .= '<p>Here is your password reset link: </br>';
$message .= '<a href="' . $url . '">' . $url . '</a></p>';
$headers = "From: Fecy <pilifmaximus@gmail.com>\r\n";
$headers .= "Reply-To: pilifmaximus@gmail.com\r\n";
$headers .= "Content-type: text/html\r\n";
$sql = "SELECT * FROM users WHERE emailUsers =?";
$stmt = mysqli_stmt_init( $conn );
if ( ! mysqli_stmt_prepare( $stmt, $sql ) ) {
header( "location: ../reset-pass.php?error=sqlerror" );
exit();
} elseif ( mysqli_stmt_bind_param( $stmt, "s", $userEmail ) ) {
mysqli_stmt_execute( $stmt );
mysqli_stmt_store_result( $stmt );
$resultCheck = mysqli_stmt_num_rows( $stmt );
if ( $resultCheck > 0 ) {
mail( $to, $subject, $message, $headers );
header( "Location: ../reset-pass.php?reset=success" );
exit();
} else {
header( "location: ../reset-pass.php?error=nomailfound" );
exit();
}
}