Such a question: there is a standard set - DB with users, an email field, it is necessary to do a mailing on the basis of 3000 users.

The grandfather method is sampling, looping, sending soap.

I wonder how you can implement the mailing list differently, without forcing the sender to wait half an hour until all 3 records are passed?

In phpbb, for example, it was implemented exactly the other way, checked: 3k users, doing a newsletter - 1 second and the letters are gone.

Can they somehow send immediately to the queue to the server or how? Thank!

  • By the way, in the case of phpbb, the "recipient" column is displayed as unclosed_recipients - Ozim
  • Apay question is very important. Is there really no clever man to such a simple question? - Ozim
  • > By the way, in the case of phpbb, the "recipient" column is displayed as unclosed_recipients. Well, if the settings are crooked, then yes. It can be seen in the code: <pre> <code> $ mail_to = ($ to == '')? 'undisclosed-recipients :;' : $ to; </ code> </ pre> But in general, if you want so much “As in phpbb”, what prevents you from digging out its code? Moreover, all the functions of sending letters are in the file functions_messenger.php - 1232
  • Kopal, but toli "horses do not go," I tired we weed .. - Ozim

3 answers 3

1 letter can be sent immediately to 100 recipients. blind copies are called. it seems like it should go faster

  • how to implement? - Ozim
  • you add the Bcc field to the letter header and there is another cycle where you shove 100 addresses. I myself tried to implement in the end I abandoned it because Php in the initial stage, so to speak. confused with these two cycles ... - Ruslan Librovsky
  • I would like to hear other methods. For some reason I strongly think that there is a better way =) - Ozim
  • I asked a similar question of a normal response and did not wait) I can wait here with you) - Ruslan Librovsky

@Ozim , my advice to you. See how Zend_Mail works. And in general, if you do not know something - see how they do it in ZF. They will not do badly. and digging into all sorts of phpbb, drupal and so on - life is not enough.

    So the answer is found.

    We use the latest version of class.phpmailer

    require 'class.phpmailer.php';

    $ mail = new PHPMailer ();

    $ mail-> From = 'my@mail.ru'; // from (email)

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

    $ mail-> AddAddress ('my@mail.ru', 'my name'); // send a letter to yourself

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

    while ($ row = mysql_fetch_array ($ sql))

    {

    $ mail-> AddBCC ($ row ['email'], $ row ['name']); // add a hidden copy, all addresses from the database will be added in the cycle

    }

    $ 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 will figure it out in time: when a non-existent address comes across to the mailer, he loudly declares this without being embarrassed right where he is working :) a bit, you have to dig the class, and I think the problem will go.