传输错误代码为 0x80040217 - 无法使用 asp.classic 和 CDO 发送
The transport error code was 0x80040217 - cannot send using asp.classic and CDO
根据网上很多帖子,报错信息
The message could not be sent to the smtp server. The transport error code was 0x80040217. The server response was not available
基本上意味着 it doesn't authenticate 因为有错误的用户 name/password
我的问题是 运行 邮件服务器。我在我的 .net 网站上推送电子邮件正常,这个问题只在使用 CDO
时存在
电子邮件、用户名和密码正确,它以纯文本形式存储在 .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
知道为什么在我的 W2012 服务器上,我可以 运行 我的 asp.classic 网站,但不能发送电子邮件吗?
当我从 MS outlook 发送邮件时,电子邮件帐户工作正常。问题只出在这里,在脚本中。
所以在评论中进行了奇怪的转换后
这个问题可能是因为 (语法高亮正确) sendusername
和 sendpassword
CDO.Configuration
属性被注释掉了,所以它可能是邮件服务器无法验证。
只需删除评论即可。
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
根据网上很多帖子,报错信息
The message could not be sent to the smtp server. The transport error code was 0x80040217. The server response was not available
基本上意味着 it doesn't authenticate 因为有错误的用户 name/password
我的问题是 运行 邮件服务器。我在我的 .net 网站上推送电子邮件正常,这个问题只在使用 CDO
时存在电子邮件、用户名和密码正确,它以纯文本形式存储在 .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
知道为什么在我的 W2012 服务器上,我可以 运行 我的 asp.classic 网站,但不能发送电子邮件吗?
当我从 MS outlook 发送邮件时,电子邮件帐户工作正常。问题只出在这里,在脚本中。
所以在评论中进行了奇怪的转换后
这个问题可能是因为 (语法高亮正确) sendusername
和 sendpassword
CDO.Configuration
属性被注释掉了,所以它可能是邮件服务器无法验证。
只需删除评论即可。
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