title: Mule 3.5.0 - How to move a file to an 'Failed' directory and send email when an exception is thrown during processing
body: <p>I have Mule flow that is reading a file (csv) from an input directory and inserting records into a database. I'd like to know how to move this file to a 'failed' directory and send a notification email should an error occur in the flow. Currently my flow is as follows:</p>
  
  <pre><code>&lt;flow name="mainFlow" doc:name="mainFlow" processingStrategy="synchronous"&gt;
  
      &lt;file:inbound-endpoint path="src/test/input" moveToDirectory="src/test/backup" responseTimeout="10000" doc:name="input-file" connector-ref="inputFile"/&gt;
  
      &lt;READS FILE INTO DATABASE&gt;        
  
      &lt;catch-exception-strategy doc:name="Catch Exception Strategy"&gt;
          &lt;file:outbound-endpoint path="src/test/error" doc:name="error-output-file"/&gt;
      &lt;/catch-exception-strategy&gt;
  
  &lt;/flow&gt;
  </code></pre>
  
  <p>Ideally, when the file is moved to the 'failed' directory, it has the same name as the original file with 'error' appended to beginning. I've not yet attempted the email notification as I'm unsure as to how to approach this. Any help/guidance would be greatly appreciated, thanks in advance!</p>