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 :[email protected]
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
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With