DTS - sending Email

01-14-2004, 05:55 AM

I have program my first DTS Package for the Microsoft SQL Server 7.0.

With the fallowing rows i am going to send an email over CDONTS.

Sub SendMail(sFromAddress, sToAddress, sSubject, sBody)
Dim objMail, errCode

'Create the mail object
Set objMail = CreateObject("CDONTS.NewMail")

'Set all the properties for this email
objMail.From = sFromAddress
objMail.To = sToAddress
objMail.Subject = sSubject
objMail.Body = sBody

'Clean up
Set objMail = nothing
End Sub

But if the DTS runs, the fallowing error occurs:

Error Code: 0
ErrorSource=Microsoft VBScript runtime error
Error Description: ActiveX component can't create object

Error on Line 77

The Code in Line 77 is "objMail.Send". If i take it out, the DTS runs without any problem! I tried to code the mail properties hard ("objMail.From = "xxx@xxx.com") but it do not works too.

Somebody could help me??!

Thanks a lot! Greetings, DaBoo_

01-14-2004, 09:04 AM
Try putting a Server. infront of CreateObject("CDONTS.NewMail")

01-14-2004, 08:26 PM
I think you mean behide don't you? eg

set objMail = CreateObject("CDONTS.NewMail", ServerName)

01-15-2004, 01:46 AM
Try putting a Server. infront of CreateObject("CDONTS.NewMail")


Thx for your answer! But..."Server"...what do you mean? I think, it's not a String? An object? Which type is it? For example, if the server called "John".

Thank you! But the Same problem...! A String don't works!

I got the feeling that I am as thick as two short planks.

Greetz, DaBoo

01-15-2004, 06:44 PM
Where is the object CDONTS located. Is it on the same machine your running your code from, or another machine? Is CDONTS a dll or ActiveX server?

If CDONTS is a dll on a different machine, you'll have to register it on the machine your running your code on. Whether CDONTS is on the same machine or a different one, you'll have to set a reference to it in your app. Not knowing what CDONTS is kind of hampers me here though.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum