我正在尝试在 Windows Server 2008 R2、IIS 7.5 上使用经典 ASP 发送电子邮件(我使用旧应用程序,所以我必须在这里使用经典 ASP)。
我想很多事情从 win server 2003 到 2008 发生了变化。我正在使用下面的代码,但我收到了这个错误(顺便说一句,错误消息是如此“信息丰富”);
error '8004020f'
/poo.asp, line 32
这是代码;
<!--
METADATA
TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library"
-->
<%
'Declare variables
Dim sch, cdoConfig, cdoMessage
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(cdoSendUsingMethod) = cdoSendUsingPort
.Item(cdoSMTPServer) = "mail.example.com"
'Set SMTP port which is 25 by default
.Item(sch & "smtpserverport") = 587
.Update
End With
Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
Set .Configuration = cdoConfig
.From = "info@example.com"
.To = "me@example2.com"
.Subject = "Sample CDO Message"
.TextBody = "This is a test for CDO.message"
.Send
End With
Set cdoMessage = Nothing
Set cdoConfig = Nothing
Response.write "<HTML><head><title>A message has been sent.</title></head><body>A message has been sent.</body></HTML>"
%>
另外,我刚刚安装了 Microsoft Exchange Server MAPI 客户端和协作数据对象 1.2.1 来自 http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=1004进入我的服务器,但它没有改变任何东西。
注意:如果可行,我可以通过本地主机发送电子邮件。没关系。
最佳答案
您可能会遇到以下错误:
error '8004020f' The event class for this subscription is in an
invalid partition
此错误消息来自 cdosys.h,与任何类型的“分区”无关 - 它实际上与重载消息中的其他错误混为一谈。错误代码实际上归因于以下内容:
CONST LONG CDO_E_RECIPIENTS_REJECTED = 0x8004020FL
这意味着电子邮件由于某种原因被服务器拒绝。以下是您可以尝试缓解问题的一些方法:
.Item(cdoSendUsingMethod) = cdoSendUsingPort
成为
.Item(cdoSendUsingMethod) = cdoSendUsingPickup
http://classicasp.aspfaq.com/email/why-does-cdo-message-give-me-8004020f-errors.html
关于iis-7 - 经典 ASP,在 Windows Server 2008 上发送电子邮件 - 错误 '8004020f',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6610551/