Hi and thanks,
I have a SSIS 2005 package that when finished it sends out a email message using "Send Mail Task" this part works fine.
I am trying to pass variable to fileattachment in sendmail task.This task is working fine if I pass the file path and file name, I am getting email with file attachment, But I want this task to pick file with different name (the variable), file path and file extension are same all the time. How do I set this up in the variable, so job will run and should pick up new file?
I have read this:
Create a variable. (done)
Edit the Send Mail Task, under the Expressions, open the Property Expression Editor, set the variable to FileAttachments Property (this part is done).
I Don't understand the rest?
Create a Package Configuration, in the Package Configuration Wizard, select the value of the variable(it will appear in the configuration file).
Deploy the package. Whenever needed, just change the value in the configuration file.
I just want the attachment to pick up the variable.
I have this in the Script Task before the Send Mail:
Dim strFileName As String
strFileName = "D:\Jobs\AccountingMonthly
\" & Year(DateTime.Now.AddDays(
-25)) & "\" & MonthName(Month(DateTime.N
(-25))) & ".xls"
").Value = strFileName
Please see FileAttachments.
Please see SendMailProperties to see if I am missing something.