gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 12:51:53 27 4
gpt4 key购买 nike

您好' 我想将所有电子邮件(进入我的收件箱)转发到 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 */

但是没有输出文件,所有电子邮件都再次退回到我的收件箱。谁能帮帮我?

最佳答案

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

关于php - 使用 php 脚本的电子邮件管道,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5591497/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com