我的网站托管在使用Tsohost的实时服务器上。我使用PHP邮件功能发送电子邮件,但我的以下邮件功能在我的代码中不起作用,但其他一切都有效。我该如何尝试实现此功能。
<?php include "resources/configuration/config.php"; ?>
<?php
if(isset($_POST['btnRecover'])) {
$Email = $_POST['Email'];
$query = "SELECT * FROM users WHERE Email = '{$Email}'";
$query = mysqli_query($connection, $query);
$numrow = mysqli_num_rows($query);
if($numrow != 0) {
while($row = mysqli_fetch_assoc($query)) {
$db_email = $row['Email'];
}
if($Email == $db_email) {
$code = rand(1000, 1000000);
$to = $db_email;
$subject = "Password Reset";
$body = "This is an automated email. Please DO NOT reply to this. Click the link below or paste it into your browser http://www.castlewellanforestpark.com/recover_password.php?code =$code&email = $Email ";
}
$query1 = "UPDATE users SET passreset ='{$code}' WHERE Email = '{$Email}'";
$query1 = mysqli_query($connection, $query1);
mail($to, $subject, $body);
echo "Check Your Email";
}
else {
echo "That Email does not exist";
}
}
?>