title: Creating an email queue in PHP?
body: <p>I am currently creating a quote system which works like this:</p>
  
  <blockquote>
    <p>User submits data through form --> data sent to db --> pdf generated --> email sent</p>
  </blockquote>
  
  <p>I am using the <code>htmlmimemail5</code> library to do this and the email generated is sent to a mail exchange on a separate server on the local network. </p>
  
  <p>Sadly the negative side of this is that the php script takes around a minute to fully execute as the script waits for confirmation from the MX that the email has been sent or has failed.</p>
  
  <p>So what I was hoping would be possible is to have a separate PHP application that handles all the email processing and means that the user does not have to wait a minute and can instead jump to the next page where they can view information etc. </p>
  
  <p>This application would happily work away on an email queue that has been built up from user process requests and if the queue is empty would possibly shut down?</p>
  
  <p>I'm guessing it would need to be some sort of email queue (like a print queue).</p>
  
  <p>However, because I am a junior PHP dev and all the other devs are too busy to babysit, I am completely lost and do not even know where to begin from or if this is even the right strategy?</p>
  
  <p>More information:</p>
  
  <ul>
  <li>Server is a BSD jail</li>
  <li>Apache 2.2 /PHP5</li>
  </ul>
  
  <p>All internal and external emails are routed through POSTINI, which adds a delay as well.</p>
  
  <p>Any ideas or suggestions welcome! :)</p>