massive mails & timeout

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I have a web site that sends emails to some 17000 newsletter
subscribers, the script takes about 5 minutes to complete the task,
depending of the size of the attachment.
The problem is that sometime it takes so much time that is difficult
to know if something is going wrong, and sometimes the script
terminates with timeout.
I thought to solve the timeout question with a set_limit_time() but i
am not sure where to put this line: inside the loop that send emails
or at the beginning of the page?
Second question is, how to control the flow and avoid that the site
administrator close the browser or click the stop button thinking that
the site is not working? could register_shutdown_function be the



Re: massive mails & timeout

On 3 Oct, 10:34, ""
Quoted text here. Click to load it

Have a google for php long running process.

The short answer is that you're never going to get this running
reliably on a remote server via a browser - run it from the comand


Re: massive mails & timeout wrote:
Quoted text here. Click to load it

Don't even try to send that many emails from a web page.  Do it
asynchronously instead.

Rather, save the information in a database and run a cron job to send a
few, then restart itself to send a few more.  Or use one of the many
bulk email packages out there (which basically do the same thing).

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: massive mails & timeout

On 3 okt, 11:34, ""
Quoted text here. Click to load it

We did a newsletter script for a customer a while ago that would send
out 30k mails.
All the newsletters (id's) went into a database, and a cronjob started
a php script every 5 minutes or so.
The script checked the database for new newsletters to send and would
send them out in bursts of 180 letters per 5 minutes.

We don't send all the newsletters at once because of the possibility
of getting the mailserver blacklisted.

Hope it helps



Re: massive mails & timeout

Quoted text here. Click to load it

Thanks for your answers, the problem is that I am not the sysadmin of
the server, only the webmaster and I don't have full access to it.

@ Daniel, could you tell me more about your script? I have never done
something similar, you can use my private email if you like it.

many thanks,


Site Timeline