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.

Community
  • 1
  • 1
MyDaftQuestions
  • 4,487
  • 17
  • 63
  • 120
  • It doesn't mean the username / password is wrong *(that is just a possible symptom)*. It means that the Mail Server did not send a response, which can be for a number of reasons. Things to check, username and password, account usage limits, account status *(is it blocked)* etc. – user692942 Oct 21 '15 at 14:06
  • Well, the username is the same as the email address. The password for testing is only 4 digits long and very obvious so I'm convinced to typos. – MyDaftQuestions Oct 21 '15 at 14:08
  • Although you do realise that in that example the `sendusername` and `sendpassword` is commented out?? – user692942 Oct 21 '15 at 14:08
  • 3
    ... I hate everything – MyDaftQuestions Oct 21 '15 at 14:10
  • 1
    Please answer it! And I'll accept this stupid question will remain forever. It was the issue of the comments @Lankymart – MyDaftQuestions Oct 21 '15 at 14:11

1 Answers1

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
user692942
  • 16,398
  • 7
  • 76
  • 175