Link to home
Start Free TrialLog in
Avatar of Bob Schneider
Bob SchneiderFlag 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

ASKER CERTIFIED SOLUTION
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of Bob Schneider

ASKER

Thanks Scott!