title: SSIS 2008 Error sending dynamic files as attachment on email task
body: <p>I have a SSIS package where I am exprting data and creating four TXT files with the exported data. The filenames are dynamically generated to include the current date and time so it will look like 'Export1_140723_<strong>1230</strong>.txt" were we have the name with the file number and the timestamp <strong>HHmm</strong>.</p>
  
  <p>Then I am emailling the file using a email task. The package takes some time to export data and there lies the problem. When it tries to include the created files into the attachments the error appears:</p>
  
  <blockquote>
    <p>[Send Mail Task] Error: Either the file "Export1_140723_<strong>1230</strong>.txt"
    does not exist or you do not have permissions to access the file.</p>
  </blockquote>
  
  <p>The file is created but has the name "Export1_140723_<strong>1231</strong>.txt" since the process took some time and the minute passed.</p>
  
  <ul>
  <li>The file names are variables that concatenate the "Export" with the
  current date using an expression. I have set the EvaluateAsExpression = TRUE. Then passed the filename to the Flat File Connection also using expressions and with DelayValidation = TRUE</li>
  </ul>
  
  <blockquote>
    <p>"Export1_" + SUBSTRING( (DT_WSTR, 30) @[User::Date], 9, 2)
                    + SUBSTRING( (DT_WSTR, 30) @[User::Date], 4, 2)
                    + SUBSTRING( (DT_WSTR, 30) @[User::Date], 1, 2)
                    + "_" + SUBSTRING( (DT_WSTR, 30) @[User::Date], 12, 2)
                    + SUBSTRING( (DT_WSTR, 30) @[User::Date], 15, 2)            +".txt"</p>
  </blockquote>
  
  <ul>
  <li>@[User::Date] is just the GETDATE() expression that I also use in another part of the package.</li>
  <li>Finally the email task has another expression for FileAttachments with DelayValidation = TRUE to fill the filenames.</li>
  </ul>