CDO.消息给出“访问被拒绝”在 Windows Server 2008 上
我有一个经典 ASP 页面,它创建一个 CDO.Message
对象来发送电子邮件。该代码适用于 Window Server 2003,但不适用于 2008。在 2008 上,会引发“访问被拒绝”错误。这是我为诊断问题而编写的一个简单的测试页。我怎样才能让它在 Windows Server 2008 上工作?
dim myMail
Set myMail=CreateObject("CDO.Message")
If Err.Number <> 0 Then
Response.Write ("Error Occurred: ")
Response.Write (Err.Description)
Else
Response.Write ("CDO.Message was created")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
End If
I have a Classic ASP page that creates a CDO.Message
object to send email. The code works on Window Server 2003 but not 2008. On 2008 an "Access is denied" error gets thrown. Here is a simple test page I wrote to diagnose the problem. How can I get this to work on Windows Server 2008?
dim myMail
Set myMail=CreateObject("CDO.Message")
If Err.Number <> 0 Then
Response.Write ("Error Occurred: ")
Response.Write (Err.Description)
Else
Response.Write ("CDO.Message was created")
myMail.Subject="Sending email with CDO"
myMail.From="[email protected]"
myMail.To="[email protected]"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
End If
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我从来没有让 CDO.Message 对象在 Windows Server 2008 上工作。但是,我找到了一个解决方法。我编写了一个适用于 Windows Server 2008 的电子邮件课程。希望这对其他人有帮助。
I never got the CDO.Message object to work on Windows Server 2008. However, I found a workaround. I wrote an email class that works on Windows Server 2008. Hope this helps someone else.
只要您使用 Microsoft SMTP 服务器(1),您就可以使用 IIS 元数据库资源管理器向 IIS_USRS 组(2) 授予对 /LM/SmtpSvc/ 和 /LM/SmtpSvc/1/ 节点的读取访问权限IIS 元数据库。
不幸的是,此解决方案不适用于 Windows 7。Microsoft 不随 Windows 7 一起提供 SMTP 服务器,因此在不重构代码的情况下很难解决此问题。
(1) 请参阅 http://www .itsolutionskb.com/2008/11/installing-and-configuring-windows-server-2008-smtp-server
(2) 请参阅 http://blogs.msdn.com/b/akashb/archive/2010/05/24/error-cdo-message-1-0x80040220-the-quot-sendusing-quot-configuration-value-is-invalid-on -iis-7-5.aspx
As long as you're using the Microsoft SMTP server(1) you can use the IIS Metabase Explorer to give the IIS_USRS group(2) read read access to the /LM/SmtpSvc/ and /LM/SmtpSvc/1/ nodes in the IIS Metabase.
Unfortunately this solution doesn't apply to Windows 7. Microsoft does not ship an SMTP server with Windows 7, making it very difficult to get around this problem without refactoring your code.
(1) See http://www.itsolutionskb.com/2008/11/installing-and-configuring-windows-server-2008-smtp-server
(2) See http://blogs.msdn.com/b/akashb/archive/2010/05/24/error-cdo-message-1-0x80040220-the-quot-sendusing-quot-configuration-value-is-invalid-on-iis-7-5.aspx