Hi,
I was trying to pipe emails to a php script. The script is working fine as I can simulate the piping from the shell:
here is read.sh
Code:#!/usr/bin/php -q <?php /* 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 */When i execute the script like this It works perfectly fine.But when I send email , it bounces back with following error:Code:root@host [public_html/broncha]# ./read.sh << EOM > this is a test mail > EOM
What can be the issue? Please helpCode: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 |/path/to/read.php generated by someuser@domain.com local delivery failed
Edit:
Sorry the fopen in the thread title has got nothing to do with this. I was getting that error earlier which I have got fixed.



LinkBack URL
About LinkBacks
Reply With Quote





