使用 php 脚本的电子邮件管道

2024-05-15

你好,我想将所有电子邮件(到达我的收件箱)转发到 php 脚本并检索电子邮件内容并将其保存在文件中。因此,我正确地添加了具有管道路径的电子邮件转发器。

转发地址:[电子邮件受保护] /cdn-cgi/l/email-protection

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

我使用以下脚本作为 pipeline.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 */

但没有输出文件,所有电子邮件都再次退回到我的收件箱。有人可以帮我吗?


确保 PHP 文件设置了执行位(即chmod +x pipe.php).

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 php 脚本的电子邮件管道 的相关文章

随机推荐