Error in class referring - CDONTS

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

asp-classic
smtp
cdonts
asked on Stack Overflow Sep 16, 2010 by RMN • edited May 30, 2012 by dplante

2 Answers

4

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 = "recipient@acme.com"
    .From = "sender@acme.com"
    .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

answered on Stack Overflow Sep 16, 2010 by Filburt • edited Sep 16, 2010 by Filburt
0

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.

answered on Stack Overflow Sep 16, 2010 by RMN

User contributions licensed under CC BY-SA 3.0