Send mail Multiple Emails

  • Hello...

    I want to use an Execute SQL Task to load an email address list from a table

    and use the variable as the TO field in the Send Mail Task.

    How to get the list into a variable ?

    how to make it work as the TO in Send Mail. Any ideas?

    Thanks

    [font="Comic Sans MS"]
    ---------------------------------------------------

    Thanks [/font]

  • Use a For Each Loop Container to iterate over the rows in your variable and put the Send Mail Task into the For Each Loop. In the Execute SQL Task you would set your resultset option to Full ResultSet. Then on the Result Set tab Add new Result and name it 0 and create new variable of type Object (EmailAddresses). Then in the For Each Loop Container Properties go to the Collection Tab and set the Enumerator to Foreach ADO Enumerator and in the lower section set the Ado Object Source variable to the EmailAddresses variable you created in the Exec SQL Task. Then on the variable mapping tab create a new EmailAddress Variable of type string that maps to index 0. Now you can use the EmailAddress variable in the Send Mail Task

  • Thanks Jack, It Works Fine Now...:)

    [font="Comic Sans MS"]
    ---------------------------------------------------

    Thanks [/font]

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply