最近为我们的邮件服务器添加了smtp身份验证,发现了一个非常有趣的事情。在to cdomessage.to字段中使用变量时,它将返回错误“8004020f”。但是,如果我硬编码电子邮件地址,它工作正常。这是我的代码:
varEmail = "someoneelse@somesite.com"
set cdoMessage = CreateObject("CDO.Message")
set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = 2
.Item(cdoSMTPServer) = "localhost"
.Item(cdoSMTPServerPort) = 25
.Item(cdoSMTPconnectiontimeout) = 10
.Update
end With
CdoMessage.Configuration = cdoConfig
cdoMessage.Subject="NEW EMAIL"
cdoMessage.From="someone@somesite.com"
cdoMessage.To=varEmail
cdoMessage.TextBody="HELLO WORLD!"
cdoMessage.Send
set cdoMessage=nothing
set cdoConfig=nothing
如何解决这个问题,以便我可以在cdoMessage.To字段中使用变量
答案 0 :(得分:2)
尝试:
.Item(cdoSendUsingMethod)= cdoSendUsingPickup
编辑2015/09/14:看起来我发布的链接进一步信息该域已丢失的链接,请查看回程存档: https://web.archive.org/web/20150518232254/http://classicasp.aspfaq.com/email/why-does-cdo-message-give-me-8004020f-errors.html
同时查看http://classicasp.aspfaq.com/email/why-does-cdo-message-give-me-8004020f-errors.html(不再工作)