Cron php & refresh
| From: | Jeffrey | Date: | Sun, 20 Apr 2008 09:27:38 +0000 |
| Subject: | Cron php & refresh | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-273315@lists.php.net to get a copy of this message | ||
I'm working on an application that includes e-mail notifications of certain events. Because the application will have hundreds or thousands of users, I've designed it so that e-mail notifications are saved to a MySQL table. Then a regular cron job runs a php page to select the data from the table, put it into a mail() command and mail.
My original vision was to have the script do about 50 mails, then pause for a 5 seconds, do a meta refresh and run through another 50 and so on - with experimentation in numbers as necessary. This process was set up because I recall reading somewhere - perhaps the manual - that it is not a good thing to run too many php mail()s in succession. Also, I worry about php time-outs.
If you know more about PHP and 'nix than I do, you already realise the fatal flaw here: meta refresh doesn't work on a cron job.
Question: is there an alternative? I appreciate I could use sleep() after every 50 mails - but there would still be the time-out problem.
I've searched the manual and via Google - but haven't found anything - possibly I am searching on the wrong terms.
Your help will be much appreciated.
Thanks,
Jeffrey