send mail task

hi.
i want to use the send mail task but i want the recipient's address to be a parameter and the content of the body as well to be based on parameters.

is it possible to do that using the dts  
if not what is the equivalent procedure in sql server to do this

Thanks


Answer this question

send mail task

  • BRCEWANE

    Hi.
    You don't need any .dtsconfig file. You can do that in 2 steps.
    First create variables for the to, cc and bcc in your package.
    In the control flow, use the Execute Sql Task to load the values from the table into these variables
    In the send mail task, use the expressions to set the values of to,cc and bcc to the values of their corresponding variables.

    Hope this helps
    Christina

  • Aleem

     CCusson15 wrote:
    Hi Christina,

    I am currently doing a similar thing, where the recipient's email is based on the value of a variable. When setting up the Send Mail task, use the Expressions to set the "To" property to be the value of the variable. (You could also store this in the database or wherever if you'd like, I happened to use a variable).

    The value of the recipient variable is then setup to be configurable in the Package Configuration (.dtsConfig) file.

    You can make most properties of the email configurable, including subject, message body, attachments, etc.

    Hope this helps!
    -Chris


    Yep, this is the way to do this. However, you could just skip the interim step of loading a variable and just populate the "To" property of the Sendmail task direct from the configuration file. Entirely up to you of course.

    -Jamie


  • Nick van Katwijk

    Christina,

    Forgive my ignorance. I am trying to pass values stored in a table in the database to the to, cc, bcc. What is the .dtsconfig and how do I find it.

    Thank you very much,

    Gregg

  • ejblake

    Hi Christina,

    I am currently doing a similar thing, where the recipient's email is based on the value of a variable. When setting up the Send Mail task, use the Expressions to set the "To" property to be the value of the variable. (You could also store this in the database or wherever if you'd like, I happened to use a variable).

    The value of the recipient variable is then setup to be configurable in the Package Configuration (.dtsConfig) file.

    You can make most properties of the email configurable, including subject, message body, attachments, etc.

    Hope this helps!
    -Chris

  • SQLShare

    Make sure the value is being passed to the variable (create one) and then pass it to the send mail task using the expressions by setting the SMTPconnection equal to the variable or through the script command.

    It should work.


  • julianchicago2

    Thanks for your help

    It worked.

  • ehanders

    "You can make most properties of the email configurable, including subject, message body, attachments, etc."

    Is it possible to make the "SMTPServer" property also a variable based property and set the variable using a config file or a SQL query I am trying to do this and keep getting the error "The SMTP Host was not specified" although I am passing the value through the config file. Is the "SMTPServer" property not configurable this way at all

    Thanks for your help.

    -narayanan.


  • send mail task