The transport error code was 0x80040217 - cannot send using asp.classic and CDO

1

According to the many posts on the web, the error message

The message could not be sent to the smtp server. The transport error code was 0x80040217. The server response was not available

Basically means it doesn't authenticate because of a faulty user name/password

The problem I have is I run the mail server. I push emails on my .net websites fine, this issue only exists when using CDO

The email, username and password are correct, it's stored in plain text in the .asp file

Set MyMail = Server.CreateObject("CDO.Message")
Set MyConfig = Server.CreateObject ("CDO.Configuration")

'MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "name@example.co.uk"
'MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "passwordIsHere"
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1" 'also tried with localhost, the actual IP of server and mail.example.co.uk (which is set up correctly)
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 ' also tried 25
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
MyConfig.Fields.Update

Any ideas why, on my W2012 server, I can run my asp.classic website, but cannot send the email?

The email account works fine when I send mail from MS outlook. The fault is only here, in the script.

email
vbscript
asp-classic
cdo.message
asked on Stack Overflow Oct 21, 2015 by MyDaftQuestions • edited May 23, 2017 by Community

1 Answer

2

So after a weird conversion in the comments

The issue is likely because (with correct syntax highlighting) the sendusername and sendpassword CDO.Configuration properties are commented out, so it is likely the mail server is failing to authenticate.

Just remove the comments and you should be good to go.

Set MyMail = Server.CreateObject("CDO.Message")
Set MyConfig = Server.CreateObject ("CDO.Configuration")

MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "name@example.co.uk"
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "passwordIsHere"
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "127.0.0.1" 'also tried with localhost, the actual IP of server and mail.example.co.uk (which is set up correctly)
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587 ' also tried 25
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
MyConfig.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
MyConfig.Fields.Update
answered on Stack Overflow Oct 21, 2015 by user692942

User contributions licensed under CC BY-SA 3.0