I have this code:
<?php
include("db.php");
$result = mysql_query("SELECT * FROM email");
while($row = mysql_fetch_array($result))
{
$to = $row['address'];
}
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "example@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
?>
In my table (“email”) I have multiple addresses.
(They are not comma sepparated.)
How could I send my message to all of those addresses?
As specified on the
mail()manual page, the “to” parameter of the function can take a comma-separated list of addresses.