电子邮件管道工作但发送退回电子邮件

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?

doulangxun7769
doulangxun7769 您可能想要在Unix和Linux中询问是什么原因导致邮件程序生成退回邮件。此外,您应该说明您正在使用的邮件软件(sendmail,postfix等)以及如何为配置为管道脚本的用户提供邮件。
11 个月之前 回复
duanfang7757
duanfang7757 我有error_reporting(0)来关闭可能弹出的任何错误。该脚本有效,它将通过管道传输的任何电子邮件上传到数据库中。我只是不希望人们通过电子邮件发送该地址来获取退回邮件。
11 个月之前 回复
doushuangai9733
doushuangai9733 为什么使用error_reporting(0)?在进行调试时,请使用error_reporting(E_ALL)。
11 个月之前 回复
doutuoji8418
doutuoji8418 它可能没有关系,但请参阅stackoverflow.com/questions/34425804/...
11 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问