这可能是一个荒谬的问题,但它一直困扰着我一段时间。我有一个通过管道传输到 PHP 脚本的邮件转发器,它可以完美接收,但是我立即收到以下错误邮件:
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/[webroot]/public_html/external/mobile/email.php
generated by mobile@[mydomain]
The following text was generated during the delivery attempt:
X-Powered-By: PHP/5.2.13
Content-type: text/html
如您所见,Exim 认为标头响应是我所拥有的脚本中的错误。该脚本可以从php://stdin完美接收电子邮件,但 Exim 会快速回复错误。
加,
- 它是从控制台运行的,而不是 Apache,因此 HTAccess 或配置 Apache 很可能什么都不做。
- 我找不到任何解决方案,或者任何有同样问题的人。
所以我的问题是:如何摆脱这两个标题?
谢谢,~强尼
编辑,来源:
#!/usr/bin/php
<?php
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 1024);
}
fclose($fd);
$dat = fopen(dirname(__FILE__).'/test.txt', 'w');
fwrite($dat, $email);
fclose($dat);