Hi in my code everything is correct like query and display conditions but mail sending the message is mail is not send.
Whats the issue in that please find out ..! Mail is not send all the verification is correct why it so please find it only mail is not working or anything issue like headers can you please tell me headers already changed .
<?php
include '../includes/config.php';
if(isset($_POST['submit']))
{
$mail=$_POST['email'];
$sql= "select * from users where email= '$mail' ";
$res = $conn->query($sql);
$num = mysqli_num_rows($res);
if($num!==0)
{
$rows = $res->fetch_array();
$to=$rows['email'];
$subject="Remind password";
$message ="Your password : ".$rows['encrypted_password'];
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <purendergoud@gmail.com>' . "\r\n";
$headers .= 'Cc: myboss@example.com' . "\r\n";
/* $headers = 'From: purendergoud@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();*/
if(mail($to,$subject,$message,$headers)){
echo "Message sent successfully...";
echo'Check your inbox in mail';
echo "<script>alert('your password sent to your mail');
window.location('login.php');
</script>;";
}
else
{
echo'mail is not send';
}
}
else
{
echo'You entered mail id is not present';
}
}
?>