RE: [PHP] Pipe an email to PHP
| From: | Thomas Tremain | Date: | Wed, 27 Aug 2003 16:58:17 +0000 |
| Subject: | RE: [PHP] Pipe an email to PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-160938@lists.php.net to get a copy of this message | ||
I am actually real close now... Thanks to your help.
The email pipes to the PHP, and I get an email response from PHP so I can
look at output. However, I still get a non-delivery message at the same
time:
==============================
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 |php -q /home/mydomain/public_html/emailtest.php
generated by emailtest@domain.com
The following text was generated during the delivery attempt:
------ pipe to |php -q /home/mydomain/public_html/emailtest.php
generated by emailtest@domain.com ------
------ This is a copy of the message, including all the headers. ------
etc...
==============================
In my /etc/valiases/domain.com file:
emailtest@domain.com: "|php -q /home/mydomain/public_html/emailtest.php"
-------
In emailtest.php:
#!/usr/bin/php -q
<?
$pipe = fopen("php://stdin", "r");
while(!feof($pipe))
{
$buffer .= fgets($pipe, 4096);
}
fclose($pipe);
//Shoot the data back to me so I can actually see the output
mail ("Thomas@mydomain.com","Autoresponce",$buffer);
?>