Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Multiple Email Attachments

Author  Topic 

rcr69er
Constraint Violating Yak Guru

327 Posts

Posted - 2009-03-16 : 06:36:32
Hi Guys

I have a folder that has a number of pdf files within it. This folder is regularly updated and may not always have the same amount of files within it.

The thing I am trying to do is to use the Send Mail Task to send all the files as attachments.

I understand that I could use a variable and place the file names in it, but as the files are not always going to be the same this wouldn’t work.

Anyone have any ideas?

Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-16 : 14:08:19
just use for each loop with file enumerator and give your folder path. inside loop use send mail task and map the filename variable (you need to create one to hold filename) to attachment property of send mail task using expression builder. then it will send files one by one as attachment. see below link for more details

http://www.sqlis.com/post/Looping-over-files-with-the-Foreach-Loop.aspx
Go to Top of Page

rcr69er
Constraint Violating Yak Guru

327 Posts

Posted - 2009-03-16 : 14:18:25
Hey

Thanks for that!

Is there any way I can send all the attachments in one email?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-16 : 14:22:12
yup..you need to create a comma seperted list of filenames and assign it to attachment property of sendmail task by means of expression builder
Go to Top of Page

rcr69er
Constraint Violating Yak Guru

327 Posts

Posted - 2009-03-16 : 15:10:43
Hey Thanks alot for that!

Can you give me an example of the list if possible?

Thanks
Go to Top of Page
   

- Advertisement -