I am trying to send emails to multiple recipients.
So far, I was able to retrieve the email addresses in an array. But the mail function somehow does not accept the email addresses. Instead, it gives an error that it needs at least one email address to send an email, and it displays the emails inside the array.
Have a look at my code below.
$email = "select email from student";
if ($p_address=mysql_query($email))
{
$address = array();
while($row = mysql_fetch_array($p_address))
{
$address[] = $row;
}
for ($i = 0; $i < count($address); $i++) {
$all_address[] = implode(';', $address[$i]);
}
foreach ($all_address as $aa) {
$mail->AddAddress($aa);
}
Hope that you could help. Thanks.