I have this code:
while($row = mysql_fetch_array($result)) { $addresses[] = $row['address']; } $to = implode(", ", $addresses);
As specified on the mail() manual page, the "to" parameter of the function can take a comma-separated list of addresses.