Forum Moderators: coopster

Message Too Old, No Replies

Sending emails with delay

         

cdmn

6:09 pm on Sep 3, 2007 (gmt 0)

10+ Year Member



Hi.

Lets say, i have 300 subscribers.
According to my hostings provider mail policy, i can send 200 emails in one hour. So its 18sec/1email.

So what are my possibilities?

1. I can send emails using set_time_limit(0) + sleep(20).
2. Set some cronjob.

Using first method, would force me to have browser window opened for ~1.5h... Not an option.
So i guess using cronjobs would be the best thing to do here.
But how to invoke/destroy cronjobs from a PHP script.

I dont have any shell acc and safe_mode is on :/

Someone please help :-)

henry0

6:33 pm on Sep 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you cannot use any form of cmd line or PUTTY
I do not know how one may set up a cron job

however there is somewhere (I remember it was discussed here) a scrip that you can use and that mimics cron.
Search here and elsewhere, sorry just did a search in my local files but I did not keep it.

Habtom

5:03 am on Sep 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Using first method, would force me to have browser window opened for ~1.5h... Not an option.

You can let it run in the background.

Exec [php.net]

Habtom

jatar_k

12:49 pm on Sep 4, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



use the cron job

then have a column in your db that tracks whether the email was already sent

when you want to send a newsletter

set the field to 'no' for all users
turn on your cron

your cron should change the column to 'yes' and then it will only send one to each user and you can turn it off whenever you want. You could even set it to run every 5 mins or more, then if you don't turn it off for a while it won't be running constantly. You could even have it send you an email to tell you it's done.

cdmn

6:55 am on Sep 5, 2007 (gmt 0)

10+ Year Member



Thats a great idea, jatar_k.
Ill probably do smth like taht.

But as i sad, the safe_mode is on,
and i didnt test exec yet. But lets say
i can use exec, how could i create/destroy cron with exec?
I really dont wont to put cron to run every minute or so,
couse at first ill be havint like 10 subscribers, so basicly
it will just increase server load without any job done...