instead of your while() loop calling mail() each time, use it to build a comma separated list of recipients, then pipe them into a Bcc (so as to not publicise everyone's email address), and send one email with all people in the Bcc list.
UNTESTED code: <? $bcc = ''; $sql = "SELECT email FROM mailingListTable"; $result = mysql_query($sql); while($myrow = mysql_fetch_array($result)) { $bcc .= $myrow['email'].','; } // $bcc will now look like: // [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED], // trim off the trailing comma $bcc = substr($bcc, 0, -1); // prepare to send $to = '[EMAIL PROTECTED]'; $subject = 'My Mailing List'; $message = 'This is my email message'; $headers = 'From: [EMAIL PROTECTED]\r\n'; $headers .= "Bcc: {$bcc}\r\n"; // send mail($to, $subject, $message, $headers); ?> Good luck -- like I said, untested code, so it may need some tweaking. Justin on 26/10/02 10:41 AM, Stephen ([EMAIL PROTECTED]) wrote: > I'm pulling email addresses from a database, then emailing them a newsletter > email. Right now, I'm calling the mail() function each time to send an email > and that's slooow. How could I make it so all the emails are put into a BCC > field then emailed all at once instead of multiple times? > > Thanks, > Stephen Craton > http://www.melchior.us > http://php.melchior.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php