Attempts to send email using classic ASP often times out

One of our customers has reported sporadic problems when our classic ASP application tries to send an email via CDOSYS to Exchange 2010 (running on Server 2008r2).

Occasionally, the 'SEND' happens immediately but it can sometimes take 30 seconds or more or even timeout ASP (90 seconds).

I use a test_mailer_components.asp page (from Pensaworks) and this exhibits the same problem - all quite random.

However, when run from the webserver (where problems above are happening) a VBS script that uses the same set of directives returns immediately, - every time.

Any ideas?
LVL 1
Trevor HelpsTechnical DirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontyWeb Ninja at largeCommented:
have you checked out any of the IIS logs or event viewer for when the error occurs?

is the message being sent complex in it's creation?
0
Trevor HelpsTechnical DirectorAuthor Commented:
Yes - there's nothing showing up in the logs/eventvwr and the messages are always very simple.
0
Wayne BarronAuthor, Web DeveloperCommented:
This does not correct the issue.
However, this will help to let you know when it has failed.
I am still learning the script, so there is still a lot that I do not know.

Run this, and see what happens.

<%
myMail.To =  "email@address.net"
myMail.Subject = "Just another test email"
myMail.From = "master@domain.com"

myMail.HTMLBody = "Send something"
result = ""
On Error Resume Next
    result = myMail.Send()
    If Err.Number <> 0 Then result = result & ", error #" & Err.Number & ": " & Err.Description
On Error GoTo 0
If result = "" Then
   Response.Write "Mail sent out successfully"
Else
   Response.Write "There was a Mail Server error.<br />We are sorry for any inconvenience."
   ' This is where you need to catch the issue, and then either
   ' 1 - Re-send out the failed emails
   ' 2 - Possible find some code to find a solution to the issue.
End IF


%>

Open in new window


Wayne
0
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Big MontyWeb Ninja at largeCommented:
Just just curious what app pool does the site run under? Is it the default one or a custom one?

If there are a lot of sites running on the server it may be worth creating iits own asp pool
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Can you post your code for both the ASP script and the VBS script.

Are you using cdoSendUsingPickup ?  I would also use authentication too.  But I think using the pickup directory will do the trick.

https://msdn.microsoft.com/en-us/library/aa563054(EXCHG.80).aspx
http://www.paulsadowski.com/wsh/cdo.htm
Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. 
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network). 

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message") 
objMessage.Subject = "Example CDO Message" 
objMessage.From = """Me"" <me@my.com>" 
objMessage.To = "test@paulsadowski.com" 
objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication."

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.your.com"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "youruserid"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpassword"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

Open in new window

0
Trevor HelpsTechnical DirectorAuthor Commented:
Thank you all for your input.
We have got around the issued of delay to the Exchange server by using local SMTP server which then smarthosts to the Exchange server.  We now deal with localserver port 25 and this in turn puts the email into its mailroot\queue directory and it eventually gets delivered via the Exchange SMTP.  There's still a hold up at that stage but as far as our application is concerned it has delivered to the local SMTP and can move on.  This has done the trick for us and saves us having to fault find the real issue on the customers Exchange platform
Scott Fell - thanks for your input on the pickup directory.  Good to know we can get mail to the local SMTP server in this fashion also.

TB Team
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Trevor HelpsTechnical DirectorAuthor Commented:
Accepting our own solution as a work around to the issue.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.