Re: Sending lots of emails - 2 choices - choose the best one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin Zvarík wrote:
> Hello--
> I want to send email to 100+ recipients. Two choices I 
> thought of:
> 
> 1) once call mail() and use BCC, but the negative of this 
> method is that every recipient in BCC has header "To" 
> same (so I used to put my email in here - not email of 
> one of the recipients).
> 
> 2) several calls to mail() function with each recipient's emal

I like #2, within a loop.

E.g.,

// variables defined:
$subject = 'My weekly newsletter';
$headers = [your mail headers here]
$message = "Blah blah \n" .
"and furthermore yada yada \n" .
"and finally so on";

while ( $record = mysql_query('SELECT email from clients etc') )
{
  $to = $record[email];
  mail($to, $subject, $message, $headers);
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux