Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2006
    Posts
    128
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Giving a delay before sending the new mail

    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

  • #2
    Senior Coder
    Join Date
    Dec 2002
    Location
    Arlington, Texas USA
    Posts
    1,072
    Thanks
    4
    Thanked 8 Times in 8 Posts
    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

  • #3
    Regular Coder
    Join Date
    Apr 2006
    Posts
    128
    Thanks
    6
    Thanked 0 Times in 0 Posts
    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

  • #4
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <%
    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"
    %>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •