Search code examples
sql-servervalidationssisetlsendmail

SSIS Send Email File Attachment Failure


My SSIS Package creates a csv with the file name containing the date time stamp. I want to email this file. so i have a variable that contains wildcards to represent my file. I have set the send email task expression for file attachement to be my 2 variables

@filelocation + @filename

@filelocation = C:\User\project\

@filename = final_ * _ *.csv

so it is looking for C:\User\project\final_*_*.csv

the file exists but I'm getting the following error

Error at Send Mail Task [Send Mail Task]: Either the file "C:\User\project\final__.csv" does not exist or you do not have permissions to access the file.

Error at Send Mail Task: There were errors during task validation.

I have delayed validation but still doesn't work any suggestions would be appreciated. the file exists and I am running as administrator


Solution

  • If you are looking to get files with the following pattern final_ * _ *.csv, add a Foreach Loop Container that retrieve files from @filelocation directory with the following pattern final_ * _ *.csv and for each file execute the Send Mail Task. (If it is only one file, it will send only one)

    Or you have to Get the files using a Script Task and store the results in a variable then use it.