SMTP 配置 SendUsing 配置值对 ASP-Classic 无效 [英] SMTP configuration SendUsing configuration value is invalid with ASP-Classic
问题描述
我正在尝试使用 ASP Classic 发送电子邮件,但在 SMTP 配置方面遇到了问题.
I'm trying to get an email sent using ASP classic, and am having trouble with SMTP configuration.
错误:
CDO.Message.1 错误80040220"SendUsing"配置值为无效.
CDO.Message.1 error '80040220' The "SendUsing" configuration value is invalid.
代码(用于电子邮件本身):
The Code(for the email itself):
Set objMsg = Server.CreateObject("CDO.Message")
objMsg.From = "name@name.com"
objMsg.To = "themetatron@gmail.com"
objMsg.Subject = "Procurement Ally Update"
objMsg.TextBody = strBody
我尝试使用 (pt 1) 配置的代码:
The Code I tried to configure with (pt 1):
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "smtpserver") = "127.0.0.1"
.update
End With
那没用,所以我尝试了:
That didn't work, so I tried:
objMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMsg.Configuration.Fields.Update
那也没用.
(是的,我没有展示它,但最后有一个对 objMsg.Send
的调用)
(Yes, I didn't show it, but at the end there's a call to objMsg.Send
)
据我所知,本地邮箱 SMTP 服务正在运行并准备好履行职责.
As far as I can tell, the local boxes SMTP service is running and ready to do its duty.
谁能帮忙?
推荐答案
如果您要指定 smptserver,请务必设置您的 'sendusing' 字段也发送到 2(或 cdoSendUsingPort):
If you are specifying an smptserver, be sure to set your 'sendusing' field to 2 (or cdoSendUsingPort) as well:
objMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objMsg.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMsg.Configuration.Fields.Update
这篇关于SMTP 配置 SendUsing 配置值对 ASP-Classic 无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!