I am encountering the same problem above and I did exacly as described . But it is not working.
I must send emails every month with dynamically named files as attachments.
The files are named according to the date on which they are generated.
For example on the first of November 2007, the file will be named myfile_1_11_2007.
I have created a variable called DynamicFileName with package scope, data type string and default value: d:\\tests\\
In "Send Mail Task Editor" Dialog Box, I have specified the following:
smtpConnection: smtptest.server.com
From :nemo@.smtptest.server.com
To: nemo@.smtptest.server.com
Subject: Dynamic File Email
MessageSourceType: Variable
MessageSource: blank
Priority: blank
Attachments: blank
In Expressions, I have specified:
FileAttachments: @.[User:ynamicFileName] + "myfile_" + (DT_STR, 4, 1252) DAY( GETDATE() ) + "_" + (DT_STR, 4, 1252) MONTH( GETDATE() ) + "_" + (DT_STR, 4, 1252) YEAR ( GETDATE() ) + ".csv"
When I execute the package, I get the following errors:
--
Error at Send Mail Task [Send Mail Task]: Either the file "d:\\tests\\myfile_1_7_2007.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.
Of course, the file does not exist. It will exist at tun-time. How can I tell the Send Mail Task to use a filename that is dynamic ?
By the way, once I have specified the code for FileAttachments, on trying to edit the Send Mail Task Properties, I can see that the Atachments field has been set to "d:\tests\myfile_1_7_2007.csv by itself: I never typed it there !! It seems that the task executes the code even before it is run. If I remove the attachment path manually, on running the dts, I get an error saying that "either the file does not exist or you do not have permission to access the file.
I would be most grateful if anyone could be of help
thanks
I am trying to work this out here. Have you checked that the file gets dynamically created BEFORE your Send Main task?
Sounds silly I know, but put a break point on the component/container that is generating the file and double check on your C drive to ensure it does actually exist.
Also d:\\tests\\myfile_1_7_2007.csv doesn't look right to me.
The UNC syntax for Windows systems is : \\computername\sharedfolder\resoyrce
Therefore I think you need to check your expression evaluates correctly!
Good luck!
|||Another thing to think about is, does the account you are running the package from have access to the folder you are trying to write to? (I also agree with the statement above that you should be using the UNC path)
Have you tried checking the delayvalidation property for the send mail task?
|||EWishdahl, let me give u a kiss!!! Muah! Muah!The delayvalidation property was the answer!!!I hope you are a girl!!Thanks !!!!!|||Negative... no man kisses please ...
Glad I could help though (remember to mark all applicable answers)
Eric Wisdahl
No comments:
Post a Comment