Cha*_*ka 7 php email pipe command-line-interface
嗨'我想将所有电子邮件(来自我的收件箱)转发到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)
但是没有输出文件,所有电子邮件都会再次弹回我的收件箱.有人可以帮我吗?
Pet*_*nee -1
如果这实际上是一个电子邮箱,为什么不使用IMAP (PHP)呢?有很多类可以用 imap @ phpclasses.org阅读邮件