Forum Moderators: coopster

Message Too Old, No Replies

continuing script with browser closed

starting script and letting it finish on its own

         

phazei

6:40 pm on Jan 3, 2007 (gmt 0)

10+ Year Member



I need a script to send an email to over 1000 tutors. It's a dynamic email list that varies for different criteria (location, sex, subjects)

I had a loop with their email addresses in an array and calling mail for each one of them. Then I found out there's a mail limit on the server of 10 emails a minute. So I'm going to call sleep for 61seconds every emails % 10.

Problem is my employer doesn't want to keep his browser open every time he sends out an email list, it would could be hours sometimes.

So how can he click send and have the script activated and then close the browser? I'm not sure how to initiate a script running on it's own server side.

Thanks,
Adam

Philosopher

6:57 pm on Jan 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds like a good example of when you need to run a cron job.

Set a cron job to run every X minutes. When nothing is in the "queue" to be done nothing happens.

He clicks send, the job is put into a queue. The next time the cron job runs it finds the project in the queue and performs it.

No need to keep the browser window open as it's not reliant on the browser.

jatar_k

6:59 pm on Jan 3, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could have a script that just sends 10, registers the fact that those have been sent, finishes, starts again, grabs the next 10 etc

it could be run via crontab

phazei

7:39 pm on Jan 3, 2007 (gmt 0)

10+ Year Member



I was reading around and I found this:
ignore_user_abort();

Though I'm thinking a once per min cron job would be a better idea. Though I would need to store the unique email list in a db and the script would have to chop the 10emails it sends off the end of the list each time.

Does anyone know of any php scripts that could do this?

I found one <snipped url> which is nice and simple and keeps a good history and is setup with a nice interface for html emails as well.
But it only sends off of a list it has stored, it isn't setup to just send from a unique list each time.
A pretty program like that would be much nicer than some no frills text box I could throw together.

Thanks,
Adam

[edited by: coopster at 10:44 pm (utc) on Jan. 3, 2007]
[edit reason] removed url [/edit]