Mail distribution

Such a question: there is a standard set – a database with users, an email field, you need to make a mailing to the database of 3000 users.

Grandfather method – fetch, loop, send soap.

I wonder how it is possible to implement a mailing list differently without forcing the sender to wait half an hour until all 3k records have passed?

In phpbb, for example, it is implemented exactly differently, I checked: 3k users, you make a mailing list – 1 second and the letters are gone.

Maybe they somehow transfer directly to the queue on the server or something?

Answer 1

1 letter can be sent to 100 recipients at once. blind copy is called. it seems like they should go faster

Answer 2

@Ozim, my advice to you. See how Zend_Mail works. And in general, if you don’t know something, see how they do it in ZF. They won’t do bad things. and digging into all sorts of phpbb, drupal and other things – life is not enough.

Answer 3

So the answer is found.

Using the latest version of class.phpmailer

require ‘class.phpmailer.php’;

$mail = new PHPMailer();

$mail->From = ‘[email protected]’; // from (email)

$mail->FromName=’my name’; // from name

$mail->AddAddress(‘[email protected]’, ‘my name’);// send an email to myself

$sql=mysql_query(“SELECT email,name FROM users WHERE 1 $add”);



$mail->AddBCC($row[’email’], $row[‘name’]); // add a blind copy, all addresses from the database will be added in the loop


$mail->IsHTML(true); // HTML format

$mail->Subject = $_POST[‘subj’]; //subject

$mail->Body = $_POST[‘mail’]; // message

$mail->Send(); // send

$mail->ClearBCCs(); // clear the address list

There is one problem, I think I’ll figure it out over time: when a mailer comes across a non-existent address, he loudly declares it without embarrassment right where he works 🙂 You need to dig a little class, and I think the problem will go away.