Once Executed Script

Hi there, just a quick one, once a script has been executed through the browser; in my case, I’ve created a bulk emailer script to blast out 7,500 emailers over the period of ten hours or so. Once I have pressed submit in the browser, will the script carry on even if I close the browser or will everything come to a half?

It will if you set the ini setting ignore_user_abort to true.
Keep in mind though that PHP scripts also have a timeout (ini setting max_execution_time) after which it will stop, unless you set it’s value to 0. It defaults to 30 seconds.

Hi, thanks for your message. I have a while loop in my script which processes each address. Am I right in thinking this will continue until it’s reached all addresses - not quitting after 30secs?

No. If max_execution_time is set to 30 seconds the script will stop after 30 seconds no matter what. Like I said, if you don’t want that, set max_execution_time to 0 (zero).

ini_set('max_execution_time', 0);

Use with care though, that setting is there for a reason: to prevent scripts from clogging up a server’s resources indefinitely (in case of an endless loop for example).

Right, I see, I’m understanding now. Not sure of the best way to send the thing. I sent our first bulk emailer from home and have now been blocked, by I presume my ISP as I sent the mailer using MAMP. Don’t want the same to happen again at work - I also don’t want the mailer to fail if it’s clogging the servers resources! No idea what to do. Had a play with PEAR but couldn’t get it to work - rather not use this method.

If you’re sending out a lot of e-mails, using one single server and just blindly sending the e-mails out is bound to get you in trouble.
ISPs do not only have limits for outbound e-mails, but for incoming e-mails as well. Something like “You can only send up to 500 e-mails to provider-this-and-that.com from one IP per hour”.
You also need to take these kind of rules into account to make sure you don’t break them.
It’s a very complicated topic that involves queuing e-mails and sending them out in a sensible manner. The big players (like CampaignMonitor) also have a huge park of servers that all have a different IP (or a set of IPs) to avoid the problem above.
This is not a problem you will solve overnight.

I think I’ll get my boss to take a look at Campaign Monitor, seems a very good solution. Using an email blast I think is perfect for 300 or so emails but when its as large as we have, we need the proper structure in place to cope with this. Thanks for your help, it’s proved very useful.