By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,357 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

massive mails & timeout

P: n/a
Hi,

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
solution?

thanks,

stefano
Oct 3 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On 3 Oct, 10:34, "stefano.troi...@gmail.com"
<stefano.troi...@gmail.comwrote:
Hi,

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
solution?
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
line.

C.
Oct 3 '08 #2

P: n/a
st*************@gmail.com wrote:
Hi,

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
solution?

thanks,

stefano
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.
js*******@attglobal.net
==================

Oct 3 '08 #3

P: n/a
On 3 okt, 11:34, "stefano.troi...@gmail.com"
<stefano.troi...@gmail.comwrote:
Hi,

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
solution?

thanks,

stefano
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

Cheers

Daniel
Oct 3 '08 #4

P: n/a
On 3 oct, 15:23, DaanK Interworking <daankinterwork...@gmail.com>
wrote:
On 3 okt, 11:34, "stefano.troi...@gmail.com"

<stefano.troi...@gmail.comwrote:
Hi,
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
solution?
thanks,
stefano

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

Cheers

Daniel
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,

stefano
Oct 5 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.