<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>
This code is to select email addresses from the database and to send them an email. what is wrong with my code, i can't get any email, Help will be appreciated. Thanks!