title: Email forward to PHP script always bounces
body: <p>I am trying to execute a PHP script when an email is received on a managed server, and I only have access through cPanel.</p>
  
  <p>Following <a href="https://stackoverflow.com/questions/20462991/executing-something-when-the-server-receives-an-email/20463133?noredirect=1">this instructions</a> I was able to get the script to work, but it still bounces the content of the email back to the sender. </p>
  
  <p>I tried to read the stdin as suggested by <a href="http://forums.cpanel.net/f5/email-forward-php-script-39083.html" rel="nofollow noreferrer">this post</a>, but nothing changed. Adding a <code>$emailtext = mailRead();</code> does read the stdin, and adding <code>echo $emailtext;</code> it writes the email text in the bounced email (so I get the text twice, one from my <code>echo</code> and once at the end of the bounced email.)</p>
  
  <p>The bounce is sent by <code>Mail Delivery System &lt;Mailer-Daemon@sti.stidev.com&gt;</code>, here is the content (in bold italic the parts that I changed):</p>
  
  <blockquote>
    <p>This message was created automatically by mail delivery software.</p>
    
    <p>A message that you sent could not be delivered to one or more of its
    recipients. This is a permanent error. The following address(es)
    failed:</p>
    
    <p>pipe to <strong><em>|/path/to/php/script</em></strong>
        generated by <strong><em>email@address.com</em></strong></p>
    
    <p>The following text was generated during the delivery attempt:</p>
    
    <p>------ pipe to <strong><em>|/path/to/php/script</em></strong>
           generated by <strong><em>email@address.com</em></strong> ------</p>
    
    <p>X-Powered-By: PHP/5.2.17 Content-type: text/html</p>
    
    <p><strong><em>here is see any output echo-ed by the script</em></strong></p>
    
    <p>------ This is a copy of the message, including all the headers. ------</p>
    
    <p>Return-path: ...</p>
  </blockquote>
  
  <p>How do I get rid of that bounce email?</p>