Re: PHP and email

From: Date: Wed, 23 Nov 2005 16:32:51 +0000
Subject: Re: PHP and email
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-226368@lists.php.net to get a copy of this message
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. 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. Petr

« previous php.general (#226368) next »