php无法通过php邮件功能接收邮件
我是php新手,我想通过php邮件功能向用户发送邮件,我已经编写了代码,但它不工作,邮件没有收到。我正在本地主机xamp服务器上测试它,下面是我的代码php无法通过php邮件功能接收邮件,php,Php,我是php新手,我想通过php邮件功能向用户发送邮件,我已经编写了代码,但它不工作,邮件没有收到。我正在本地主机xamp服务器上测试它,下面是我的代码 <?php include "connection.php"; if(isset($_POST) & !empty($_POST)){ //print_r($_POST); die; $username = mysqli_real_escape_string($conn, $_POST['username'
<?php include "connection.php";
if(isset($_POST) & !empty($_POST)){
//print_r($_POST); die;
$username = mysqli_real_escape_string($conn, $_POST['username']);
$sql = "SELECT * FROM `users` WHERE username = '$username'";
$res = mysqli_query($conn, $sql);
$count = mysqli_num_rows($res);
if($count == 1){
echo "Send email to user with password";
}else{
echo "User name does not exist in database";
}
$r = mysqli_fetch_assoc($res);
$password = $r['password'];
$to = $r['username'];
$subject = "Your Recovered Password";
$message = "Please use this password to login " . $password;
$headers = "From :abc23@gmail.com";
if(mail($to, $subject, $message, $headers)){
echo "Your Password has been sent to your email id";
}else{
echo "Failed to Recover your password, try again";
}
}
?>
its not right forward,签出its not right forward的可能重复项,签出its not right forward的可能重复项,签出its not right forward的可能重复项