title: Exception: Serialization of 'Closure' is not allowed
body: <p>So I am not sure exactly what I would have to show you guys, how ever if you need more code please do not hesitate to ask:</p>
  
  <p>So this method will set up the initMailer for Zend with in our application:</p>
  
  <pre><code>protected function _initMailer()
  {
      if ('testing' !==  APPLICATION_ENV) {
          $this-&gt;bootstrap('Config');
          $options = $this-&gt;getOptions();
          $mail = new Zend_Application_Resource_Mail($options['mail']);
      }elseif ('testing'  ===  APPLICATION_ENV) {
          //change the mail transport only if dev or test
          if (APPLICATION_ENV &lt;&gt; 'production') {
  
              $callback = function()
              {
                  return 'ZendMail_' . microtime(true) .'.tmp';
              };
  
              $mail = new Zend_Mail_Transport_File(
                  array('path' =&gt; '/tmp/mail/',
                          'callback'=&gt;$callback
                  )
              );
  
              Zend_Mail::setDefaultTransport($mail);
          }
      }
  
  
      return $mail;
  }
  </code></pre>
  
  <p>You can see the closure that lies with in. When I run any tests that use this code I get:</p>
  
  <pre><code>Exception: Serialization of 'Closure' is not allowed 
  </code></pre>
  
  <p>and thus all the tests in relation to this "closure" fails. So I am here asking you guys what I should do.</p>
  
  <p>For clarification on the above, all were doing is saying that any email we send out we want to store information about that email in a folder in the /tmp/mail/ directory in a file.</p>