Re: Re: PHP and email

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

 



Petr Smith wrote:
Thanks to those who have replied so far, yes our main concern is the smtp server falling over or dying. So to come back to John Nichel's answer:

John, have you done this personally and I assume the effects were good?? IE everything ran smoothly?



I have done it just as John has described above, though I didn't have 8000 to send. All went well, no hiccups. A couple of things I would mention is
that I seem to remember reading somewhere that the sleep() function on
Windows eats a lot of processor.  Not an issue for me since I'm on Linux,
but worth a mention. And the function John suggested above will take over
22 hours to send 8000 emails.  Since you say its a one shot deal, its
probably OK.


I don't think the long running script with sleep function is the best approach to this problem. I would recommend writing the whole queue somewhere (to database) and run script every 5 minutes, load some not sent yet e-mails (100), send them and write info (it_was_sent tag) back to database.

What's to stop you from writing this 'sent tag' using the sleep method? What I wouldn't like about the every 5 minutes cron method is that the script will run _every_ five minutes regardless if it's sending mail or not. Not to mention the fact that even with a small number like a 100, you could still cause problems with the mail server trying to make that many SMTP connections in less than a second or two.

It's always better to not have long running script, you never know what can go wrong and if it fails somewhere or process is killed or machine rebooted or something happens, you don't know which emails were sent and which not. And there's no stupidest thing as sending the same company newsletter twice to the same client.

You computer is full of scripts/programs/daemons that have long runs...some 24/7. That isn't a problem as long as you think ahead. With proper logging, I can easily pick up where I left off should the script fail for one reason or another.

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnichel@xxxxxxxxxxxxxxxxxxxxxxxxxxx

--
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