email to php piping problem

SuperDave2U

New member
Aug 13, 2008
134
6
0
I'm trying to pipe a raw email to a php script which will then save the msg exactly as it's received as a text file.

This is what I got but when I send a msg to the test address I get a bounce back with the error below:
PHP:
#!/usr/bin/php –q
<?
@chdir(realpath(dirname(__FILE__)).'/'); //Change dir.

$data=isset($_SERVER['HTTP_HOST'])?file_get_contents('php://input'):file_get_contents('php://stdin');
if (!empty($data)) ? file_put_contents("mail.txt",$data) : return NULL ;
?>
The bounce
Code:
This message was created automatically by mail delivery software.

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:

  pipe to |/home/super/public_html/email.php
    generated by [EMAIL="testdrop@superdave2u.com"]testdrop@superdave2u.com[/EMAIL]
    local delivery failed

The following text was generated during the delivery attempt:

------ pipe to |/home/super/public_html/email.php
       generated by [EMAIL="testdrop@superdave2u.com"]testdrop@superdave2u.com[/EMAIL] ------

Status: 404 Not Found
X-Powered-By: PHP/5.2.9
Content-type: text/html

No input file specified.
The file is there with 755

I know piping works on this system from tests with another app that uses them to create support tickets but can't seem to put the pieces together for my purposes. Any ideas?

tits.jpg