2

最近在我们的邮件服务器中添加了 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 字段中使用一个变量

4

1 回答 1

2

尝试:

.Item(cdoSendUsingMethod) = cdoSendUsingPickup

编辑 2015/09/14:看起来我发布的链接进一步信息域已丢失,请检查回程存档: https ://web.archive.org/web/20150518232254/http://classicasp.aspfaq.com/电子邮件/why-does-cdo-message-give-me-8004020f-errors.html

另请查看http://classicasp.aspfaq.com/email/why-does-cdo-message-give-me-8004020f-errors.html(不再工作)

于 2013-01-25T08:08:31.267 回答