Canman2005 Posted October 27, 2008 Share Posted October 27, 2008 Hi all I wondered if someone can give me some advice. Basically I have this little newsletter system, I do a PHP QUERY to return all rows in a newsletter table and then run a PHP mail for each row returned. I have started to get a few people signing up and recently I ran my script and my host moaned that I used lots of bandwidth and tied the server up, he suggested I get the script to send out 10 mails every 5 minutes to avoid this happening. How could I get my script to just return 5 rows, wait 5 mins and then return another 5 rows and then repeat that again until no more rows are returned. Can anyone give some good advice? Thanks Dave Quote Link to comment Share on other sites More sharing options...
Fruct0se Posted October 27, 2008 Share Posted October 27, 2008 I have had the same problem and as a result I wrote a program which will do this and it is available on gemscripts.com Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted October 27, 2008 Author Share Posted October 27, 2008 thanks but I was kinda looking for a simple script and something I didn't have to pay for, only because their is no budget for me to buy anything. Quote Link to comment Share on other sites More sharing options...
Fruct0se Posted October 27, 2008 Share Posted October 27, 2008 Well, if you have a script which sends mail already you can use header refresh to reload the script multiple times until the job is done, you can set the script to refresh every X amount of seconds. You will need to pass a variable to the script each time it refreshes to indicate where it left off in your mailing. Then use that variable as the offset in your SQL query. 1'st script load send 5 emails - headers refresh in 60seconds passing the variable = 5 2'nd run, script offsets by 5 using the variable past and sends 5 more, headers refresh in 60 secs etc...etc... This is just some basic info that will hopefully get you started. Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted October 27, 2008 Author Share Posted October 27, 2008 cool thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.