• Hi All,

    One common question I get about this article is about the email not working.  The article's example assumes you have a valid, open relay SMTP service running from your client or SQL Server instance machine.

    If you don't, here is a code example of referencing a remote SMTP service:

    Function Main()
    Dim iMsg

    Dim objMail 

    Const cdoSendUsingPickup = 1

    Const cdoSendUsingPort = 2

    set iMsg = CreateObject("CDO.Message")

    set iConf = CreateObject("CDO.Configuration")

    Set Flds = iConf.Fields

    With Flds

        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort

    'Change this parameter below to your valid SMPT Server Name

        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="10.10.10.99"

        .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10 

        .Update

    End With

    With iMsg

     Set .Configuration = iConf

    .From = "test@test.com"

    .To = "test@test.com"

    .AddAttachment ( "c:\temp\test.xls")

    .Subject="Test Spreadsheet"

    .TextBody = "Spreadsheet"

    .Send

    End With

    Set objMail = nothing
    Main = DTSTaskExecResult_Success

    End Function

     
    Best Regards,
     
    Joe