Forum Moderators: coopster

Message Too Old, No Replies

Pause in between sending 50 emails at a time

Pause concept

         

henry0

3:37 pm on May 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am planning to send opt-in emails by chuncks of 30 to 50 at a time
and would like pausing between each chunks

1) is using sleep() feasable or using:?
2) how long should I set the sleep for?

(it will never be over a grand total of +/- 200 emails)

whoisgregg

3:44 pm on May 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A cron job is really the best tool for this job. Set the cron to run every minute/five minutes/whatever and send 30 emails each time.

For 200 emails though, it probably isn't necessary to spread those out.

henry0

3:48 pm on May 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK thanks, so a cron it will be

The reason for splitting the load is that regardless that it runs on my own server

I was told that as a better chance not to look like spam I should not go over 50 at a time

joelgreen

5:55 pm on May 16, 2007 (gmt 0)

10+ Year Member



BTW, there is a difference between sleep() and cron which in your case is not so important (not sure if i'm really correct). Cron will send chunks exactly each NN secs, while sleep will count NN secs from last email sent.
So sleep will work better if chunk hangs for some reason.

Cron:
12:30 - send first chunk (script hangs)
12:32 - send next chunk (one more hangs)

sleep:
12:30 - send first chunk (script hangs) - it does nothing more

henry0

6:08 pm on May 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually I was just going to post
Since the cron job timing is hard coded via SSH
Using cron to send emails might not be the way to go
Let me explain further

Example:
Joe needs a widget that might be found in a given state.say FL.
Joe triggers the "search" to locate such a widget.
My script goes through the membership and select all members opt-in and FL
Then the script emails to the selected members.

Which tells us that we have no control on when it will be sent as such cron does not look to be the correct solution to my little problem!
Correct?

jatar_k

8:57 pm on May 16, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



ah, but you're missing something

if Joe searches now then the email to be sent could be added to a queue and sent when the cron runs next

you don't always want these things firing right away, a queue is often a better way to go as it gives you more control.

as to the hanging

it won't hang if you handle errors properly, well maybe if the mail server goes down but more likely that would cause the mail function to fail and kill the script

henry0

10:21 pm on May 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



jatar, very good point!
might be more solid in the long run.