I am trying to pipe an email to PHP. I currently have set up a forwarder in cPanel that does the following :
|/home/username/public_html/mailscripttest.php
mailscripttest.php has permissions 755 and contains:
#!/usr/bin/php –q
<?
/* Read the message from STDIN */
$fd = fopen("php://stdin", "r");
$email = ""; // This will be the variable holding the data.
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);
/* Saves the data into a file */
$fdw = fopen("mail.txt", "w+");
fwrite($fdw, $email);
fclose($fdw);
/* Script End */
However when I send an email I get a bounced message saying:
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/username/public_html/mailscripttest.php
generated by test-script@nicholasquinlan.com
local delivery failedThe following text was generated during the delivery attempt:
------ pipe to |/home/username/public_html/mailscripttest.php
generated by test-script@nicholasquinlan.com ------Status: 404 Not Found
X-Powered-By: PHP/5.2.13
Content-type: text/htmlNo input file specified.
------ This is a copy of the message, including all the headers. ------
What am I doing wrong and how can I fix it?
Thanks.
--
Nick