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
When i execute the script like this It works perfectly fine.But when I send email , it bounces back with following error:
What can be the issue? Please help
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.
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 */
Code:
[email protected] [public_html/broncha]# ./read.sh << EOM
> this is a test mail
> EOM
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 |/path/to/read.php
generated by [email protected]
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.