Avatar of Bob Schneider
Bob Schneider
Flag for United States of America asked on

HMLHttp.SetTimeouts

I am trying to send race results to race finishers in classic asp and my script keeps timing out.  I have my Server.ScriptTimeOut set plenty high.  (note that I just added the xmlhttp.SetTimeOuts)  Not sure if I have the other timeout set correctly.  Can someone look at the following code and let me know what changes might help please?  Thans!

Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
    .Item(cdoSendUsingMethod) = cdoSendUsingPort
    .Item(cdoSMTPServer) = "smtp.mandrillapp.com"
    .Item(cdoSMTPAuthenticate) = 1
    .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
    .Item(cdoSendUsername) = "username"
    .Item(cdoSendPassword) = "pwd"
    .Update
End With

    bSentBCC = False

	For j = 0 To UBound(SendTo) - 1
		'get email address
		sMyEmail = vbNullString
				
		If DontSend(SendTo(j)) = False Then sMyEmail = SendTo(j)

		If Not sMyEmail = vbNullString Then
			If ValidEmail(sMyEmail) = True Then
                            
                sPageToSend = "http://www.gopherstateevents.com/misc/pix-vids_notif.asp?event_id=" & lEventID 

                Set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
	                xmlhttp.open "GET", sPageToSend, false
                    xmlHttp.SetTimeouts 0, 60000, 300000, 300000
	                xmlhttp.send ""
	                EmailContents = xmlhttp.responseText
                Set xmlhttp = nothing

			    Set cdoMessage = CreateObject("CDO.Message")
			    With cdoMessage
				    Set .Configuration = cdoConfig
    				    .To = sMyEmail
				    .From = "bob.schneider@gopherstateevents.com"
                   		    .Subject = "Pictures Are Ready for " & sEventName
				    .HTMLBody = EmailContents
				    .Send
			    End With
			    Set cdoMessage = Nothing
		    End If
        End If
	Next

    Set cdoConfig = Nothing

Open in new window

ASPXML

Avatar of undefined
Last Comment
Bob Schneider

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Scott Fell

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Scott Fell

Bob, I just noticed you are using Mandrill. My bad for not catching that.  In this case, you may be getting an error back from Mandrill that is causing it to time out. Look at your Mandrill admin panel.

Also, they give you two options for sending, SMTP and the API. The API may be less likely to time out.  This is what I was referring to above.

Post here if you are still running into an issue.
Bob Schneider

ASKER
Thanks Scott!
Your help has saved me hundreds of hours of internet surfing.
fblack61