...

View Full Version : Giving a delay before sending the new mail



telmessos
03-30-2007, 04:55 PM
Hi all,

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 ?

Thanks

miranda
04-01-2007, 04: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

telmessos
04-02-2007, 09:30 PM
Hi Miranda,

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?

Thanks

Ceyhun

degsy
04-18-2007, 03: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.

degsy
04-18-2007, 04:18 PM
<%
Loops = 5
Interval = 5
Server.ScriptTimeout = loops*interval

x=0
t = Now
loopStart = t
Response.Write "Loop Started: " & loopStart & "<br>"
Response.Flush()

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
Response.Flush()
End If
Loop

loopEnd = Now
Response.Write "Loop Ended: " & loopEnd & "<br>"

loopDuration = DateDiff("s",loopStart,LoopEnd)
Response.Write "Loop Duration: " & loopDuration & " seconds"
%>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum