电子邮件管道与php脚本 [英] Email piping with php script
问题描述
转发地址:tickets@ana.stage.centuryware.org
管道程序:/ home /centuryw/public_html/stage/ana/osticket/upload/api/pipe.php
我将以下脚本用作pipe.php
#!/ usr / bin / php -q
<?
/ *从STDIN * /
$ fd = fopen(php:// stdin,r)读取消息;
$ email =; //这将是保存数据的变量。
while(!feof($ fd)){
$ email。= fread($ fd,1024);
}
fclose($ fd);
/ *将数据保存到文件* /
$ fdw = fopen(mail.txt,w +);
fwrite($ fdw,$ email);
fclose($ fdw);
/ *脚本结束* /
但没有输出文件,所有电子邮件都被退回再次到我的收件箱任何人都可以帮助我吗?
确保PHP文件具有执行位设置(即 chmod + x pipe.php
)。
Hi' I want to forward all the emails(which are come to my inbox) to php script and retrieve email content and save it in a file. So do that I was add email forwarder with piping path correctly.
Address to Forward :tickets@ana.stage.centuryware.org
Pipe to a Program : /home/centuryw/public_html/stage/ana/osticket/upload/api/pipe.php
I have used following script as 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 */
But there was no output file and all email are bounced to my inbox again. Can anyone help me please?
Make sure the PHP file has the execute bit set (i.e. chmod +x pipe.php
).
这篇关于电子邮件管道与php脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!