Error in class referring - CDONTS

1k views Asked by At

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

2

There are 2 answers

0
RMN On BEST ANSWER

I got the solution. I added a new CDONTS.dll and registered it using

regsvr32 C:\SYSROOT\system32\cdonts.dll

This solved the problem. No need of adding it to the references.

0
Filburt On

ASP-Classic

Since CDONTS is discontinued since Win2000 and newer you should switch to CDOSYS.

Sample code for sending via remote server

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 = "[email protected]"
    .From = "[email protected]"
    .Subject = "A Subject Line"
    .TextBody = "A Text body message"
    .Fields.Update
    .Send
End With

The linked site features detailed examples for all kinds of scenarios.

ASP.NET

If you are targeting ASP.NET you should use System.Net.Mail instead of CDO