<html>
<body>
<?php
include 'index.php';
include '../db.php';
$query_email = "SELECT email FROM email_addresses";
$result_query_email = mysqli_query($query_email)
or die(mysqli_error());
while ($row = mysqli_fetch_array()($result_query_email)) {
//$email_user = $row[10];
$email_user = $row['email'];
$data = date("Y.m.d");
$subject = "Good news";
$message = ("Hello!");
$sentemail = mail($email_user, $subject, $message,
"From: abc <xyz.com>\nX-Mailer: PHP/" . phpversion());
}
if($sentemail)
{
print("Email has been sent successfully.<br>");
}
else
{
print("There was a problem while sending email.<br>");
}
?>
</body>
</html>
此代码用于从数据库中选择电子邮件地址并向他们发送电子邮件。我的代码有什么问题,我无法收到任何电子邮件,将不胜感激。谢谢!