title: Catch Exception Strategy
body: <p>My Mule studio version is:
  version: 3.4.0
  buildDate: 201305141336</p>
  
  <p>I am confused on the catch exception strategy... and maybe I need to use a different strategy. Basically I need to write data to a file. After the file write I want to send an email to indicate whether the write was successful or not. (Failure is most likely to happen if someone has the file open at write time). I originally tried putting an email in the catch exception block but what happened then was that I got both emails; the one in the catch block and the one at the end of the flow. I attempted to create a variable with the email subject in it and change the value out in the exception but it doesn't seem to do anything. I still get the email with the success message in it. </p>
  
  <p>Does anyone have some suggestions on how to make this work? Ultimately, I just want to send a different email based on the file write success/failure. Here is my configuration. I have been causing the failure by opening the target file with Excel which locks the file.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:smtp="http://www.mulesoft.org/schema/mule/smtp" xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
  http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  http://www.mulesoft.org/schema/mule/smtp http://www.mulesoft.org/schema/mule/smtp/current/mule-smtp.xsd
  http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/current/mule-quartz.xsd
  http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
  http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
  http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd"&gt;
      &lt;flow name="FileOpenExample" doc:name="FileOpenExample" &gt;
  &lt;quartz:inbound-endpoint xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz" jobName="fileOpenEx" cronExpression="0,30 * * ? * FRI" repeatInterval="0" repeatCount="2" responseTimeout="10000" doc:name="Quartz"&gt;
              &lt;quartz:event-generator-job/&gt;
          &lt;/quartz:inbound-endpoint&gt;
          &lt;set-payload value="Some Sample File Data" doc:name="Set File Data"/&gt;
          &lt;set-variable variableName="emailSubject" value="File Save Successful" doc:name="Variable"/&gt;
          &lt;file:outbound-endpoint path="C:\Temp\IntegrationTesting" outputPattern="Attributes.csv" responseTimeout="10000" doc:name="File"/&gt;
          &lt;set-payload value="This email was generated by a Mule process." doc:name="Set Email Body"/&gt;
              &lt;smtp:outbound-endpoint host="mail1.newpig.com" to="${email.toList}" subject="#[emailSubject]" responseTimeout="10000" doc:name="EmailSuccess"  /&gt;
          &lt;catch-exception-strategy doc:name="Catch Exception Strategy" enableNotifications="false"&gt;
              &lt;expression-transformer expression="#[emailSubject='Save Failed']" doc:name="Expression"/&gt;
          &lt;/catch-exception-strategy&gt;    &lt;/flow&gt;
  &lt;/mule&gt;
  </code></pre>