Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDONTS Confusion 1

Status
Not open for further replies.

InsaneProgrammer

Programmer
Jan 17, 2001
44
0
0
US
I'm trying to use the code below to send an email from my vb application. I get the following error:

Run-time error '429':
ActiveX component can't create object


The error occurs on the .Send command. I'm trying to do this on Windows 2000 Professional. I registered cdonts.dll. Do I need to have IIS installed? I've used similar code before in asp. Any help would be appreciated.

Code:
Public Sub SendEmail(sFileName As String)
    Dim oEmail As CDONTS.NewMail
    
    Set oEmail = CreateObject("CDONTS.NewMail")

    With oEmail
        .From = "somebody@somewhere.com"
        .To = "somebody@somewhere.com"
        .Subject = "some subject"
        .Body = "some more info"
        .AttachFile sFileName
        .Send
    End With

    Set oEmail = Nothing
        
End Sub

InsaneProgrammer.com
 
You may be interested in strongm's comments in thread222-932195
 
I looked at that post prior to posting this one but didn't find it helpful. Thanks though.

InsaneProgrammer.com
 
Use CDOSYS not CDONTS as it's now deprecated. If it's not already installed (which it should be) then copy it from a Windows 2000 server or an XP machine and register it using RegSvr32.

CDOSYS has very similar methods and properties to CDONTS and it will only take a few minutes to change your program.

Don't forget that you will need a properly configured SMTP service that you can use to send your emails preferably the normal one used by your organization although you can also use the default SMTP service on your own PC provided it has been setup and started.



Bob Boffin
 
>didn't find it helpful

However, you ask whether you need to have IIS installed. My post makes the specific point that CDONTS does not have the ability to send mail itself, leveraging instead the SMTP component of IIS. So I'd suggest that having IIS installed with a running SMTP service would be a good starting point

It is also worth pointing out that MS would prefer you to use the somewhat more flexible (although fractionally more complex) CDO for Windows 2000 on Windows 2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top