Script taking too long
This is causing the buffer limit to exeed I believe or something. Either way, I'll explain what's happening and hope someone can help.
I've written a mass email page, it allows my administrator to email everyone on the database in one go, looping through the recordset to send each email out one at a time. This is working fine, but upon talking to my server admin there is a risk of being blacklisted if more than 120 emails are sent out in a minute.
As this is the case, I needed to slow the script down (I timed it and it took less than 15 seconds to email 55 people) and thought an easy way would be to delay it by a a second every email, meaning it could never send out more than 60 in a minute. I changed script time out to 300 seconds to stop it timing out and flush the page at the top to display a loading screen.
The problem I now have, is it takes absolutely ages instead, definately too long - it was 3 minutes before I gave up and it had only delivered 30 of the emails. Can anyone help me sort this delay out to stop it sending more than 120 emails in a minute.
My idea was the following, but for some reason this doesn't work correctly and slows it down more than it should.
If intTurn = 1 Then
intTurn = 0
Do Until Second(now) = Second(now)+1
' Wait
Loop
End If
|