0

I get an error at the following line in my application:

'create NewMail object'
Line 96: Function SendHTMLEMail (strFrom, strTo, strCC, strSubject, strBodyHTML)  
Line 97: Set objNewMail = Server.CreateObject("CDONTS.NewMail")

The error is:

Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string 
/Utils.inc, line 97

I have added interop.CDONTS.dll to the references of application, but still I am getting same error.

I am not sure if this functionality is used in any other page and is working.

I use .NET 2003 framework 1.1, and the server is running Windows Server 2003

4

2 回答 2

4

ASP-经典

由于 CDONTS 自 Win2000 及更新版本以来已停产,您应该切换到 CDOSYS

通过远程服务器发送的示例代码

Set oMessage = CreateObject("CDO.Message")
Set oConfig = CreateObject("CDO.Configuration")

Set oFields = oConfig.Fields

With oFields
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.acme.com"
    .Update
End With

With oMessage
    Set .Configuration = oConfig
    .To = "recipient@acme.com"
    .From = "sender@acme.com"
    .Subject = "A Subject Line"
    .TextBody = "A Text body message"
    .Fields.Update
    .Send
End With

链接站点提供了各种场景的详细示例。

ASP.NET

如果你的目标是 ASP.NET,你应该使用System.Net.Mail而不是 CDO

于 2010-09-16T10:56:13.960 回答
0

我得到了解决方案。我添加了一个新的 CDONTS.dll 并使用它注册了它

regsvr32 C:\SYSROOT\system32\cdonts.dll

这解决了问题。无需将其添加到参考文献中。

于 2010-09-16T11:20:39.057 回答