Hey. I want to forward all emails (that get to my inbox) to a php script and upload the contents of the email and save it in a file. So do it, I correctly added the mail forwarding with the channel.
Forwarding address: tickets@ana.stage.centuryware.org
Trumpet to the program: /home/centuryw/public_html/stage/ana/osticket/upload/api/pipe.php
I used the 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 the emails again ended up in my inbox. Can anybody help me?
source share