title: Forwarding emails with a PHP script
body: <p>We have a cron'ed PHP script that checks an inbox every ten minutes. The purpose of this script is to handle "STOP to quit" functionality for our SMS notification service we provide. If the script finds any emails with the word "STOP" at the beginning of the email, we remove the user from our notification database.</p>
  
  <p>To cover our bases, we'd like any emails that don't meet the above criteria to be forwarded on to another email address (which is an alias) that several people receive and check hourly. However, we're running into problems forwarding the emails from this PHP script.</p>
  
  <p>Knowing how the <code>mail</code> function of PHP works, it's quite obvious we need to reinsert the headers before mailing. However, MIME multipart emails always get sent as a garble of text, including the barriers and any base64 encoded attachments.</p>
  
  <p>Does anyone know of a simple way to take an email message and forward it on properly using a PHP script?</p>
  
  <p>We're using the native IMAP functions built in to PHP 5. We also have access to the PEAR Mail module. However, we have been unable to find any examples or people doing similar tasks by searching Google.</p>