Link to home
Start Free TrialLog in
Avatar of TransBind
TransBind

asked on

DTS Package email does not send

I am trying to send an email using DTS Package. I created db connection, execute sql task and an active x script task, the source code for the active x script is below. When i run the dts package it completes without any problems but i never receive an email. What are possible reasons for me not to receive an email? Cdonts r not set up correctly?
active x script task is run on success of execute sql task
'**********************************************************************
'  Visual Basic ActiveX Script
'************************************************************************

Function Main()

      On Error Resume Next

      dim strEmailBody
      dim objMail
      
      'add Larry to this list for a final version
      'should email upon success of synchronizing CP records
      const EXECUTIVE_EMAILS = 'mail@xxxxx.com'

      set objMail = CreateObject('CDONTS.NewMail')

      strEmailBody = 'Status Report:' & vbCrLf & _
      'Downstream synchronization ' & _
      'of data has completed successfully. '
      
      objMail.To = EXECUTIVE_EMAILS
      objMail.Subject = 'Synch Down Status Report (Success)'
      objMail.Importance = 2 'High

      objMail.Subject = strEmailBody
      objMail.Send

      if err.count = 0 then
      Main = DTSTaskExecResult_Success
      else
      Main = DTSTaskExecResult_Failure
      end if

End Function
Avatar of Sirees
Sirees

What version of SQL Server?
SOLUTION
Avatar of Sirees
Sirees

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
But to answer your question consider removing the following line:
 On Error Resume Next

And you may have a better chance of trouble-shooting the problem.