Email Forwarding issue -q not working

632 Views Asked by At

What I need to do is to forward [email protected] to be piped to a php script that resides in my server.. is home/myhost/autoprocess.php. I just got it working by using the below mentioned code.

#!/usr/bin/php -q
<?php

// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd))
{
    $email .= fread($fd, 1024);
}
fclose($fd);


mail('[email protected]','From my email pipe!','"' . $email . '"');

?>

I The -q part tells the pipe not to bounce an email back to the sender. Everything works but the pipe still bounce an email back to the sender. The email says like this..

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/myHost/autoreply.php generated by info@myHost

The following text was generated during the delivery attempt:

------ pipe to |/home/myHost/autoreply.php generated by [email protected] ------

/usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /usr/bin/php) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libexslt.so.0) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libexslt.so.0) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1) /usr/bin/php: /opt/xml2/lib/libxml2.so.2: no version information available (required by /opt/xslt/lib/libxslt.so.1)

------ This is a copy of the message, including all the headers. ------

There is no problem in just I want to stop the autoreply sent to the sender with the error mentioned above. I donno whats the error as its piped correctly to the php script and I get an email in [email protected]

2

There are 2 best solutions below

0
On

some servers will send the bounce message if there is any kind of error (or even a warning) what I did is put error_reporting(0); at the beginning of my code and the problem went away

0
On