locked
Sending Mail to all email addresses in a table.... RRS feed

  • Question

  • Hi,

      I am trying to send an email to multiple recipients one at a time.

    All the email ids are stored in a column named email in a table in DB.

    I am trying to use ssis to do that.Please,tell me how can i achieve this?

    Monday, February 13, 2012 11:59 PM

Answers

  • Hi,

    Use a Execute sql task to read that column into a OBJECT type variable, set "Full Result Set" in the Result Set page

    use for each loop container to itterate over the object variables, shred it into STRING variables,set the Enumerator property
    to "Foreach ADO Enumerator", the mode to "Rows in the first table", and select the ADO object from the list.

    and use that in a "send mail task" using an expression.

    Check that post http://asqlb.blogspot.com/2012/02/ssis-send-e-mail-from-sql-table.html

    • Edited by Jason Yousef Tuesday, February 14, 2012 2:54 AM add link
    • Proposed as answer by Eileen Zhao Tuesday, February 14, 2012 8:36 AM
    • Marked as answer by Eileen Zhao Monday, February 20, 2012 7:17 AM
    Tuesday, February 14, 2012 2:23 AM

All replies

  • Hi,

    Use a Execute sql task to read that column into a OBJECT type variable, set "Full Result Set" in the Result Set page

    use for each loop container to itterate over the object variables, shred it into STRING variables,set the Enumerator property
    to "Foreach ADO Enumerator", the mode to "Rows in the first table", and select the ADO object from the list.

    and use that in a "send mail task" using an expression.

    Check that post http://asqlb.blogspot.com/2012/02/ssis-send-e-mail-from-sql-table.html

    • Edited by Jason Yousef Tuesday, February 14, 2012 2:54 AM add link
    • Proposed as answer by Eileen Zhao Tuesday, February 14, 2012 8:36 AM
    • Marked as answer by Eileen Zhao Monday, February 20, 2012 7:17 AM
    Tuesday, February 14, 2012 2:23 AM
  • Hi,

    Sendind email from SSIS can be done using Send Mail Task.

    To send mail to multiple people you can write all the mail id's in To address of Send Mail Task or

    You can ask your network admin people to create one smtp account which can hold multiple mail id's and you can use that smtp account to send mail to multiple people.

    If you want to send mails to the mail id's which are in table you can send using database mail profile but you need to configure the profile first.

    srikrishna

    Tuesday, February 14, 2012 2:26 AM
  • Hi SriKrishna,

    Could you please give some examples how to configure the profile for database email

    Suguna

    Monday, September 16, 2013 8:13 PM