我正在尝试使用ASP classic发送电子邮件,并且遇到SMTP配置问题.
错误:
CDO.Message.1错误'80040220'"SendUsing"配置值无效.
代码(针对电子邮件本身):
Set objMsg = Server.CreateObject("CDO.Message") objMsg.From = "name@name.com" objMsg.To = "themetatron@gmail.com" objMsg.Subject = "Procurement Ally Update" objMsg.TextBody = strBody
我尝试配置的代码(第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
这没用,所以我试过:
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
)
据我所知,本地盒子SMTP服务正在运行并准备好履行职责.
有人可以帮忙吗?
如果要指定smptserver,请务必将" sendusing "字段设置为2(或cdoSendUsingPort):
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