[Last Call] Learn how to a build a cloud-first strategyRegister Now


ASP.NET - CDONTS mail -  Error:Cannot create ActiveX component.

Posted on 2005-04-06
Medium Priority
Last Modified: 2013-11-25
Since I haven't worked with ASP.NET for over a year, I forgot what I did when my code worked. It is probably some setting, or whatever, but I cannot remember.

My problem is that on the line below (marked with '<<<') I have the error message "Cannot create ActiveX component."
I use WIndows XP with IIS 5 and the Microsoft Visual Basic .NET    (version 2003)
Any help is appreciated.


 Sub SendMail(ByVal strContent As String, ByVal strDate As String)

        Dim strSubject As String = "Review for - " & strDate
        Dim objSendMail = CreateObject("CDONTS.NewMail") '<<< it is here that the problem occurs
        Dim HTML As String
        'Dim objSendMail As New MailMessage   ' NEW

        Dim js As New JavaScript ' my class

        ' Set all the properties on the NewMail object
        objSendMail.From = conFrom '"Me@my.com"
        objSendMail.To = EmailList()

        objSendMail.Importance = 1  '  0: faible 1=normale 2=haute
        objSendMail.BodyFormat = 0  '0
        objSendMail.MailFormat = 0  '0 - HTML; 1 - PlainText
        objSendMail.Subject = strSubject

        objSendMail.Body = strContent

            'Send the message
            'SmtpMail.Send(objSendMail) 'NEW
            js.MsgAlert(Me, "Sent.", "alert")
        Catch exc As Exception
            js.MsgAlert(Me, "Retry.", "alert")
            objSendMail = Nothing
        End Try

    End Sub
Question by:mjasic
  • 2
  • 2
LVL 25

Accepted Solution

nauman_ahmed earned 500 total points
ID: 13717887
Windows XP do not ship with CDONTS.dll.  You can copy the CDONTS.dll from c:\winnt\system32 directory of a Windows 2000 PC and the use the regsvr32 CDONTS command to register it on XP box.

Best, Nauman.

Expert Comment

ID: 13717926
It's not classic asp...

Use the built in Mail object in .NET - it's a lot easier.

LVL 25

Expert Comment

ID: 13718012
I think the CDONTS library is needed with the Sytem.Web.Mail namespace.  Any updates?

Thanks, Nauman.


Author Comment

ID: 13718144
It worked.
Thank a lot.


Author Comment

ID: 13718286
My problem was that I changed a laptop one year ago (XP Pro instead of 2000 Pro) and after that, I never had the opportunity to test my old ASP.NET applications. I didn't know that CDONTS.dll no more exists on XP :(

- CDONTS does not need System.Web.Mail namespace.
- Why I don't use built-in mail object?  Because I have no idea what is the server IP or name. When I finish testing the application on my PC, I copy my site to a test server (does not have SMTP installed), and then the administrator copies the files to a production server.
So, I really don't know what the name of the server is. And the code with Mail object never worked on my laptop (the same reason).

Thanks for help.


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question