小编Cha*_*ka 的帖子

用PHP脚本发送电子邮件管道

嗨'我想将所有电子邮件(来自我的收件箱)转发到PHP脚本并检索电子邮件内容并将其保存在文件中.所以,我正确地添加了带有管道路径的邮件转发器.

转发地址:tickets@ana.stage.centuryware.org

管道到程序:/home/centuryw/public_html/stage/ana/osticket/upload/api/pipe.php

我使用以下脚本作为pipe.php

#!/usr/bin/php –q
<?
/* 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 */
Run Code Online (Sandbox Code Playgroud)

但是没有输出文件,所有电子邮件都会再次弹回我的收件箱.有人可以帮我吗?

php email pipe command-line-interface

7
推荐指数
2
解决办法
7370
查看次数

标签 统计

command-line-interface ×1

email ×1

php ×1

pipe ×1