I have been searching around for solution but could not find anyone. before i show my code things i want to let you know are. I have used gmail email to receive email from not worked even created email in domain still that did not worked. code is working fine even mail is getting send but i cannot receive it.
if(isset($_POST['forget'])) {
        $myemail = "admin@study-material.info";
        $email = $_POST['email'];
        $password = $_POST['password'];
        include("../functions/backend.php");
        $obj = new Crud;
        $uemail = $obj->forget($email);
    if(mysqli_num_rows($uemail) > 0){
        foreach($uemail as $show){
             $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
$password = substr( str_shuffle( $chars ), 0, 8 );
            $obj->updatepassword($password,$show['Email']);
    $to = $show['Email'];
    $subject = "Your Recovered Password";
    $message = "Please use this password to login <br> password: " .   $password. "<br>Email: " . $show['Email'];
    $headers = "From: $myemail";
    if(mail($to, $subject, $message, $headers)){
        echo "Your Password has been sent to your ".$show['Email']."";
    }else{
        echo "Failed to Recover your password, try again";
    }
        }
    }
            else
        {
            echo "<script>alert('Email you intered not registered.');</script>";
        }
  }
