tags:

views:

775

answers:

3

Hi guy i have a program which use to send group emails, i set a cornjob per mins for this program, and set execute per 2nd/min, and check if the now time is match to my defined schedule time in db. if true the program will run and send email, else nth...

the problem is i want to dynamic set the amount of email sending per mins by user, let say i have 10000 emails to send, and i want to send 3 emails per min, something like that, but i cant find the way when using cronJob, (set cookie? record the current email to db?), since i found that if i use sleep(), it will cause php execute limit error...

Can anyone tell me how to do that? or using other method to do schedule task? pear? if using other methods, can show how to use it briefly ? Please And Thx

+1  A: 

First of all. 10000 emails with 3 per minute will take over 2 days.

Secondly, the best way to do this is to save the emails to database (to, title, body etc) and then create a script that sends out 3 emails and set the cronjob to run every minute.

Also check out these questions.

Ólafur Waage
A: 

I think you should set this configuration at the application level rather than the cron job level.

Let's say, cron job should run every minute but the application itself should know howmany e-mails to send when a cron job runs by checking the datetime for the last e-mail is sent, and let's say, send 3 more e-mails and so.

Danny Maya
A: 

its only example to said 3 emails per mins actually i want to give user to set the amount of sending email per min/ per hour/ per second

and i know about the send email program, but what if mutil task doing.. such as 3 newsletter will blast at 20/3/2009 15:15:00; each of those target to 10000pls

i dun want to save the whole blast list in db, since client may import a email list for 40000 ppls, always timeout when import, even i set the time limit to 2 mins, dun want to take more then that time

so do u have any sugeestion on the email sending?