I'm working on a script that pipes email messages to a database. I have the script working, but it sends a bounce email too.
Here is the bounce message:
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/montanah/public_html/admin/getmail.php
generated by test@domain.com
The following text was generated during the delivery attempt:
------ pipe to |/home/montanah/public_html/admin/getmail.php
generated by test@domain.com ------
Here is the code I am using:
#!/usr/bin/php -q
<?php
error_reporting(0);
require("db.php");
$email_msg = ''; // the content of the email that is being piped
// open a handle to the email
$fh = fopen("php://stdin", "r");
// read through the email until the end
while (!feof($fh)){
$email_msg .= fread($fh, 1024);
}
fclose($fh);
MDB::insert("res_recieved_mail", array("time"=>time(), "body"=>$email_msg, "status"=>1));
exit(0);
I have tried all of the following: ending with exit(0);, not ending with exit. return null;, ending with ?> I've CHMODDED 0700, 0755, 0777 I have made sure there are no blank lines, in either my script, or db.php I've made sure my editor (notepad++) is using unix new lines not windows, and I am uploading as ASCII not binary.
Any ideas?