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

Hello,
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.

Mike

 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

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

    End Sub
LVL 2
mjasicAsked:
Who is Participating?
 
nauman_ahmedConnect With a Mentor Commented:
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.
0
 
Type25Commented:
It's not classic asp...

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

http://www.411asp.net/func/goto?id=4838710&qry=mail
0
 
nauman_ahmedCommented:
I think the CDONTS library is needed with the Sytem.Web.Mail namespace.  Any updates?

Thanks, Nauman.

0
 
mjasicAuthor Commented:
It worked.
Thank a lot.

Mike
0
 
mjasicAuthor Commented:
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.

Mike
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.