if you had solution please help me to fix it. please? mail was sent but it always visible on spam message. so how i keep it for inbox. please check my code deeply and give me right answer for matching my code. i used this point i create user login part and i want to give user to recovery option. then user will try to recovery i will send user to mail.
<?php
session_start();
mysql_connect(***, ****, ***);
mysql_select_db('*****');
$email = $_POST["email"];
$_SESSION["email_id"]=$email;
$a = rand(100,999999);
//echo $a;
$_SESSION["random"]=$a;
$to = $email;
$subject = "Verification Code";
$message =
"<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<h2 style='color:#000CA5;'>Your Verification code is : </h2><br><h2><b>$a</b></h2>
</body>
</html>";
$header = "From:****@**.com \r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html;charset=UTF-8" . "\r\n";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true ) {
// echo "Message sent successfully...";
$sql = "update random set ran_num='$a' where emailid='$email'";
mysql_query($sql);
IF(!mysql_query($sql)){
die("erroe processing :".mysql_error());
}
else{
echo "<script language='javascript' type='text/javascript'> location.href='password_update.php'
</script>";
}
}
?>