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

DTS Emailing Using CDO

Status
Not open for further replies.

shaunk

Programmer
Aug 20, 2001
402
AU
I have built a last step (Activex Script Task) in a package that sends email on package completion.

The code is

Code:
'**********************************************************************
'  Visual Basic ActiveX Script
'************************************************************************



Function Main() 

Dim iMsg,iConf,Flds,strHTML
	Const cdoSendUsingPort = 25

	set iMsg = CreateObject("CDO.Message")
	set iConf = CreateObject("CDO.Configuration")
	Set Flds = iConf.Fields

	With Flds
	    .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 25
	    .Item("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "My_SMTP_Server" 
	    .Update
	End With
	
	With iMsg
	    Set .Configuration = iConf
	    .To = "Headcase@headcasecentral.com"
	    .From = "Headcase@headcasecentral.com"
	    .Subject = "Success"
	    .HTMLBody = "<body>Yes, you can <b>HTML</b> as  much as <blink>you</blink> want here</body>"
	      .Send
	End With

	Set iMsg = Nothing
	Set iConf = Nothing
	Set Flds = Nothing

Main = DTSTaskExecResult_Success 

End Function

It parses OK. But on execution of the step, an error message is posted "Fields update failed. For further information, examine the Status property of individual field objects'
 
Sorry...wrong forum. I thought I was in a SQL Server DTS forum.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top