I am Creating a forget Password page when user click on forget password and enters his/her Email address a link is sent to his/her Email my code works fine but the email goes in Spam/junk folder.
can any one help me why this is happening??
Here is my code
<?php
$remail = mysqli_real_escape_string($con,$_REQUEST['name']);
if (!filter_var($remail, FILTER_VALIDATE_EMAIL)) // Validate email address
{
$message = "Invalid email address please type a valid email!!";
}
else
{
$query = "SELECT id FROM users where email='".$remail."'";
$r = mysqli_query($con,$query);
$Results = mysqli_fetch_array($r);
if(count($Results)>=1)
{
$encrypt = $Results['id'];
$encrypt=md5(sha1(md5($encrypt)));
$message = "Your password reset link send to your e-mail address.";
$to=$remail;
$subject="Forget Password";
$from = 'miniface';
$body='Hi, <br/> <br/>Your Email is '.$_REQUEST['name'].' <br><br>Click here to reset your password http://link.com'.$encrypt.'&action=reset <br/> <br/>--<br>miniface.com<br>Solve your problems.';
$headers = "From: " . strip_tags($from) . "\r\n";
$headers .= "Reply-To: ". strip_tags($from) . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to,$subject,$body,$headers);
else
{
$message = "Account not found please signup!";
}
}
echo $message;
?>