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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDO.Message script gives error but sends e-mail..help

Status
Not open for further replies.

aswolff

Programmer
Jul 31, 2006
100
US
I grabbed a snippet of code from this forum to send e-mail from a DTS package via ActiveX script. The script is shown below.

I have a package with one task (ActiveX Script task). When I execute the package I get the following error but yet I receive the e-mail just fine:

Code:
Error:
The task reported failure on execution
Multiple-step OLE DB operation generated errors
Check each OLE DB status value, if available, no work was done

Code:
Function Main()

    Dim myMail   
    Set myMail=CreateObject("CDO.Message")

    myMail.Subject = "New AgeIn Load"
    myMail.From = "admin@mycompany.com"
    myMail.To = "me@mycompany.com"
    myMail.TextBody = "Enter Your Message Here, "
    myMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2 
    myMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL]  = "smtp.mycompany.com"
    myMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25 
    myMail.Configuration.Fields.Update
    myMail.Send
    set myMail=nothing

If ErrorCount <> 0 Then
          Main = DTSTaskExecResult_Success
Else
          Main = DTSTaskExecResult_Failure
End If

End Function
 
surely you mean:

IF ErrorCount = 0 then success
else fail

--------------------
Procrastinate Now!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top