So this is my code for sending an email. When I try to send an email i get right message, in this case "User Exist" and "Email is sent", but i can't receive an email. So can somebody find mistake and try to help me?
<form action="forgot2.php" method="post">
Enter you email ID: <input type="text" name="email">
<input type="submit" name="submit" value="Send">
</form>
error_reporting(0);
$email=$_POST["email"];
$Subject = "GOSPodin covek";
if($_POST['submit']=='Send')
{
    mysql_connect('localhost','root','') or die(mysql_error);
    mysql_select_db('login');
    $query="select * from clanovi where email='$email'";
    $result=mysql_query($query) or die(error);
    if(mysql_num_rows($result))
    {
        echo "User exist"; 
    }
    else
    { 
        echo "No user exist with this email id";
    }
}
if(mysql_num_rows($result))
{
    $code=rand(100,999);
    $message="You activation link is: http://localhost/login_form/forgot.php?          email=$email&code=$code";
    mail($email, "Subject Goes Here", $message);
    echo "Email sent"; 
}
else
{
    echo "No user exist with this email id";
}
 
     
     
     
     
     
    