Re: One mail function, multiple recipients

From: Date: Sun, 27 Oct 2002 22:09:54 +0000
Subject: Re: One mail function, multiple recipients
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-121621@lists.php.net to get a copy of this message
Hello, On 10/27/2002 06:23 PM, Dwalker wrote:
You'll need to be careful with this method. In an effort to keep spam to a minimum, some ISP's may refuse messages with more than X number of email address attached. Then the question becomes: did everyone on the list actually receive the message?
The ISP that refuse messages to many recipients in BCC, certainly will not allow you to send separate messages to the as many recipients because that overloads even more their servers. That has nothing to do with whether you are sending spam or solicited bulk mail like newsletters. Thas has to do with abusing the mail server resources compromising the quality of service to other customers . Whether you send separate messages or a single message with all recipients in Bcc, you need to ask your ISP if you are not infringing the acceptable use policy. In shared servers you are most likely abusing. Regards, Manuel Lemos
-----Original Message----- From: Justin French <justin@indent.com.au> To: Stephen <webmaster@melchior.us>; PHP List <php-general@lists.php.net> Date: Friday, October 25, 2002 7:53 PM Subject: Re: [PHP] One mail function, multiple recipients
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: // justin@indent.com.au,webmaster@melchior.us,bob@somewhere.com, // trim off the trailing comma $bcc = substr($bcc, 0, -1); // prepare to send $to = 'dummyAddress@somewhere.com'; $subject = 'My Mailing List'; $message = 'This is my email message'; $headers = 'From: me@mine.com\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 (webmaster@melchior.us) 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
-- Regards, Manuel Lemos

« previous php.general (#121621) next »