简体   繁体   English

传输错误代码为0x80040217-无法使用asp.classic和CDO发送

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

According to the many posts on the web, the error message 根据网络上的许多帖子,错误消息

The message could not be sent to the smtp server. 该消息无法发送到smtp服务器。 The transport error code was 0x80040217. 传输错误代码为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 我可以在.net网站上正常发送电子邮件,仅当使用CDO时存在此问题

The email, username and password are correct, it's stored in plain text in the .asp file 电子邮件,用户名和密码正确,以纯文本格式存储在.asp文件中

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? 为什么在我的W2012服务器上可以运行asp.classic网站但无法发送电子邮件的任何想法?

The email account works fine when I send mail from MS outlook. 从MS Outlook发送邮件时,该电子邮件帐户工作正常。 The fault is only here, in the script. 错误仅在脚本中存在。

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. 之所以可能出现此问题,是因为(以正确的语法突出显示了) sendusernamesendpassword CDO.Configuration属性已被注释掉,因此邮件服务器可能无法通过身份验证。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM