SSIS email an attachement from a package variable

I have created an SSIS package that will produce a .csv file as an output every month, however now they want this emailed. I thought no problem, I added a send mail task. Then I attempted to add a "FileAttachments" expression from my user::strFileName variable. This only works if the file already exists. However that does not work for me because the filename actually has the date in it, so there are never 2 files with the same name. When I try to run the package with my new "send mail task" added I get an error on package validation that the "file does not exist". The file will never exist when this runs as an automated job because the file name contains the day the package ran and it only runs 1x per month. How can I get around this?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Reza RadConsultant, TrainerCommented:
do you run your package once a month or every day?
if you run it once a month and for that specific date the file genereated, then there should be no problem, Send mail task should be able to work correctly.
but if you run every day and you want the send mail task only works when there is a file then you can check for existance of the file with a script task like this:

and only direct the control flow to send mail task if the file exists. here is how you can implement such if condition with Precedence constraint to say do the second task only if the expression is returning this result;

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sqlagent007Author Commented:
This is great. Thank you
sqlagent007Author Commented:
thanks again!
Reza RadConsultant, TrainerCommented:
Glad it helped.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.