gpt4 book ai didi

email - ASP 经典电子邮件 '80040213' 传输无法连接到服务器

转载 作者:行者123 更新时间:2023-12-04 03:19:08 27 4
gpt4 key购买 nike

我知道这里有很多问题,但似乎没有一个对我有用的答案。

我的应用程序是 ASP Classic,它运行的服务器是 Windows Server 2000(我知道很老了),我使用的是 Office365 服务器,并且我在登录电子邮件时使用的是 Office365 提供的信息(端口 587,正确的用户名和密码,正确的 smtp 服务器,TLS 设置为 true)。

我总是收到“CDO.Message.1 error '80040213' The transport failed to connect to the server”。作为错误消息,它出错的行是 .Send 命令。

    Const cdoSendUsingMethod           = "http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = 2
Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort = "http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout = "http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic = 1
Const cdoSendUserName = "http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword = "http://schemas.microsoft.com/cdo/configuration/sendpassword"
'Use SSL for the connection (False or True)
Const cdoSendTLS = "http://schemas.microsoft.com/cdo/configuration/smtpusessl"

' create CDOSYS objects
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")

'Set our smtp server
objCDOSYSCon.Fields.Item(cdoSMTPServer) = "smtp.office365.com"
objCDOSYSCon.Fields.Item(cdoSMTPAuthenticate) = cdoBasic
objCDOSYSCon.Fields.Item(cdoSendUserName) = "my.email@email.com"
objCDOSYSCon.Fields.Item(cdoSendPassword) = "password"
'objCDOSYSCon.Fields.Item(cdoSMTPServerPort) = 587
objCDOSYSCon.Fields.Item(cdoSendUsingMethod) = cdoSendUsingPort
objCDOSYSCon.Fields.Item(cdoSendTLS) = True
objCDOSYSCon.Fields.Item(cdoSMTPConnectionTimeout) = 30

objCDOSYSCon.Fields.Update

'Use our new configurations for our mailer
Set objCDOSYSMail.Configuration = objCDOSYSCon

strSpecFile = Application("px683_network_downloads_specs") & strSpecFileName

objCDOSYSMail.From = "to.email@email.com"
objCDOSYSMail.To = "my.email@email.com"
objCDOSYSMail.Subject = "A subject"
objCDOSYSMail.HTMLBody = "Some text for the body"

'Normal level of importance
objCDOSYSMail.Send

set objCDOSYSMail = nothing
set objCDOSYSCon = nothing

我也尝试过使用端口 25,但没有任何运气。如果我使用另一个根本不使用 SSL 的电子邮件服务(本地服务,而不是 Office365),我没有问题(我注释掉了 usessl 并将端口更改为 25)。此外,如果我尝试使用在 ASP.Net 应用程序中完美运行的其他电子邮件服务,我会遇到同样的问题,这个其他电子邮件服务使用端口 25 和 SSL,而不是 Office365 服务。

最佳答案

我以前遇到过这个问题。基本上,您没有经过身份验证以使用服务器上的邮件传输。

您的 SMTP 服务器不允许发送出站邮件(例如停止邮件中继),您的用户名和密码不正确,或者您使用的端口需要更高的安全级别才能发送邮件。在后一种情况下,Office365 可能需要 SSL 身份验证……也许值得一看。

如果所有其他方法都失败了,您可以尝试使用 3rd 方提供商。我们在 4.35 英镑的套餐中使用 SendInBlue。您最多可以通过他们的系统发送 40,000 封电子邮件。我们发现将邮件发送到第 3 方完全消除了服务器设置停止邮件传输功能的问题。我们现在将它用于 Classic ASP 和 PHP 站点。

希望有帮助。

关于email - ASP 经典电子邮件 '80040213' 传输无法连接到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39497697/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com