03-30-2007, 03:55 PM
I've written a newsletter system for my web site. I get the emails from the database and send them using a loop. But I do not want to add a delay between two emails not cause heavy load on the mail server. Can anyone give me an idea ?
04-01-2007, 03:22 PM
If you are using a webpage in asp to send the mail you are not touching the mail server, the mail will be sent off of the webserver using CDO
However to delay anything just use a timer to add the delay
04-02-2007, 08:30 PM
I know I also use CDO to send the emails. Once the loop starts and code sends the first email, I want the code give 5 sec break after sending the second email. By doing this I won't cause a long que on the smtp server. Do you have any timer code examples?
04-18-2007, 02:50 PM
You can add "sleep" code to your scripts but that will just inclrease the load on your script/server and may lead to timeouts.
You are best off installing an email component that can handle bulk email.
04-18-2007, 03:18 PM
Loops = 5
Interval = 5
Server.ScriptTimeout = loops*interval
t = Now
loopStart = t
Response.Write "Loop Started: " & loopStart & "<br>"
Do Until x = loops
If Now > t Then
Response.Write "Loop: " & x & "<br>"
'Response.Write now & " - "
'Response.Write t & "<br>"
t = DateAdd("s",interval,t)
x = x+1
loopEnd = Now
Response.Write "Loop Ended: " & loopEnd & "<br>"
loopDuration = DateDiff("s",loopStart,LoopEnd)
Response.Write "Loop Duration: " & loopDuration & " seconds"