locked
Send mail with attachment RRS feed

  • Question

  • I have one folder which may or may not contain a file. so If that folder contains a file then I want to attach that with a mail while doing send mail task.
    Tuesday, June 7, 2011 11:11 AM

Answers

  • One and ONLY ONE file? Do you know it's filename explicitly? If so, try to do a File System operation on it and that operation will either fail (if the file does not exist) or succeed. If it succeeds, (let's say you did a File Move operation), then set up a precedence constraint to the Send Mail Task.

    Another option would be to set up a Script Task that simply checks for the existance of the file and sets a (Boolean) Control Variable accordingly. Then your Precedence Constraint would be "Success and Expression" and the Expression would be: "@MyControlVariable". (Note that you don't need anything as complex as "@MyControlVariable == True" because if @MyControlVariable is already of Boolean Type, then just examining its contents will evaluate to either True of False!)


    Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
    Tuesday, June 7, 2011 12:13 PM