asp-classic - asp CDO.Message.1 错误 '80040213' 传输无法连接到服务器。/check.asp,第 25 行

标签 asp-classic

CDO.Message.1 error '80040213'

The transport failed to connect to the server.

/check.asp, line 25

请帮助解决这个问题

检查此代码
<%@ Language=VBScript %>
<html>
<head>
</head>
<body>
<%
dim to_field, message
to_field = Request.Form("to_field")
message = Request.Form("message")
'Create the e-mail server object
Set objCDOSYSMail = Server.CreateObject("CDO.Message")
Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
'Out going SMTP server
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.example.com"
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
objCDOSYSCon.Fields.Update
'Update the CDOSYS Configuration
Set objCDOSYSMail.Configuration = objCDOSYSCon
objCDOSYSMail.From = "admin@example.com" ' the address you want the email to be from
objCDOSYSMail.TO = "anuradha@gmail.com"  'the address the mail is to be sent to
objCDOSYSMail.Subject = "Subject goes here"
objCDOSYSMail.HTMLBody = "fffffffffff"
objCDOSYSMail.Send
'Close the server mail object
Set objCDOSYSMail = Nothing
Set objCDOSYSCon = Nothing
%>
<p>Mail sent successfully to address <%=to_field%>!</p>
</body>
</html>

最佳答案

您需要在发送前添加您的用户名和密码。这是因为您在 sendusing 中使用了值 2的领域。这意味着您正在使用身份验证。

'Your UserID on the SMTP server'
objCDOSYSCon.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "yourusername"

'Your password on the SMTP server'
objCDOSYSCon.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpassword"

关于asp-classic - asp CDO.Message.1 错误 '80040213' 传输无法连接到服务器。/check.asp,第 25 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4333068/

相关文章:

sql-server - ELMAH 错误和经典 Asp

html - Web 应用程序打印按钮在不同客户端站上针对 IE8 的行为不同

mysql - ä 存储为 ä 值在数据库中编码

asp-classic - 使用 CAPICOM 进行哈希处理和加盐?使用 asp-classic 的 SHA 512

sql-server - 为什么我的 ADODB.Command 的输出参数在执行时没有检索到值?

asp-classic - 剩余的过程调用或参数无效

asp-classic - 启动 ASP session

encoding - 如何在经典 ASP 中使用 XMLHttp 对象为 POST 设置字符集?

sql-server - 这是出于某种跟踪目的而修改我的 URL 的机器人吗?

sql - 在经典 ASP 中使用存储过程 .. 执行并获取结果