Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 26th, 2004, 12:09 PM
Registered User
 
Join Date: Mar 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DelayTimer or WaitTimer

I work for a public school system and this newsletter is being used to notify vendors of upcoming bids.

I want to send an email, and then delay the sending of another one for 10 seconds. Is there delaytimer or waittimer code that will accomplish this?

Thank you, Sherry Hall
Here is my code:

' -- GET LIST OF PEOPLE TO EMAIL
    ' -- OPEN DATABASE CONNECTION
    Call openDB ()

    ' -- SET AND EXECUTE SQL STRING
    strSQL = "SELECT userid, name, email1, email2, email3 FROM yesmail"

    Call createRS (objRs)

    If objRs.EOF AND objRs.BOF Then
        ' -- CLOSE THE CONNECTION AND OBJECTS
        Call closeConnRS (objRs, objConn)
        ' -- CREATE SESSION MESSAGE
        Session ("strMessage") = "No members were found in the mailing list."
        Response.Redirect "vemadmin.asp"
    Else
        ' -- ASSIGN TO ARRAY
        Call arrayGetRows ()
        ' -- CLOSE THE CONNECTION AND OBJECTS
        'Call closeConnRS (objRs, objConn)
    End If


    ' -- SEND BULK EMAIL TO THE LIST MEMBERS
    EmailCount = 0
    Email.AutoGenerateTextBody = False
    Email.MimeFormatted = False
    Email.CreateMHTMLBody "http://*********/admin/purchasing/vemnewsltr.asp"
    Email.TextBody = "If you can see this text, you are not using an HTML enabled email client or your email client could not interpret this HTML. To view all open bids and quotes, go to ******/admin/purchasing/bidindex.asp."

    ' -- SEND THE BULK MAIL MESSAGE TO EACH USER IN TURN
        For i = 0 to ubound (arrayData, 2)
        Email.To = ""
        iSend = False


            Email.From = "[email protected]"
            Email.Subject = "Open Bid and Quote Announcements"
            If Len(Trim(arrayData(2,i)))>0 Then
                Email.To = arrayData (2,i)
                EmailCount = EmailCount + 1
                iSend = True
            End If

            If Len(Trim(arrayData(3,i)))>0 Then
                Email.To = Email.To & ";" & arrayData (3,i)
                EmailCount = EmailCount + 1
                iSend = True
            End If

            If Len(Trim(arrayData(4,i)))>0 Then
                Email.To= Email.To & ";" & arrayData (4,i)
                EmailCount = EmailCount + 1
                iSend = True
            End If

        If iSend = True Then
        Email.send
        strSQL = "INSERT INTO emailsent (userid,name,email1,email2,email3) values(" & "'" & arrayData(0,i) & "', " & "'" & arrayData(1,i) & "', " & "'" & arrayData(2,i) & "', " & "'" & arrayData(3,i) & "', " & "'" & arrayData(4,i) & "'" & ")"
        objConn.Execute (strSQL)
        End If
        Next

    Set Email = Nothing
    ' -- CLOSE THE CONNECTION AND OBJECTS
    Call closeConnRS (objRs, objConn)

    ' -- HANDLE THE REDIRECTION BACK TO THE ADMIN PAGE
    Session ("strMessage") = "The Email has been sent to '" & EmailCount & "' people."
    Response.Redirect "vemadmin.asp"
 
Old March 28th, 2004, 01:18 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

ASP is not designed to perform these kind of tasks. You need to create some other process that handles this. Usually this type of process involves saving some data in the database with the timeout timestamp (i.e. now + X minutes). Then you have a process that runs on the database as some interval (once per minute) that checks the data and looks for the rows that have "expired" and acts upon those. This is easily done in MSSQL server if this is what you are using.

Peter
------------------------------------------------------
Work smarter, not harder.









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.