I have been looking at the forum on this topic all day.
I followed some of the code, which was posted by someone.
But here is the problem.
When I type in the actual email address in "Bcc: " section,
it works. However, when I create a variable and assign
email addresses from database and use the following code,
it doesn't work. It gives me a server internal error.
Here is the code I have.
$result = mysql_query($query);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
//loop through results
while($row){
$bcc .= $row['Email'] . ', ';
}
$headers .= " Bcc: <$bcc>\r\n";
// Send the message
$ok = mail($to, $subject, $message, $headers);
if ($ok) {
echo "<p>Mail sent!</p>";
} else {
echo "<p>Mail could not be sent. Sorry!</p>";
}
mysql_close();
I have checked if the query returns data from database,
and it does. Does anyone see error that I don't see?
Please help me!!!!