homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Email piping not working

 2:07 am on Jan 10, 2013 (gmt 0)

Hello all,

It has been a while since I don't find myself in such desperate need of help.

I am trying to pipe email to a php script and I have tried so many different things from articles and tutorials and I keep getting bounced back.

So it seems a small bit of code could do most handling and at the very least not get bounced and this is my script:

#!/usr/bin/php -q

$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)){
$email .= fread($fd, 1024);

In my cPanel (from hostgator (in case is important)) I've added a forwarder to the email address in question like so:


Isn't this enough for it to work?

How do I make sure #!/usr/bin/php -q is the right path to my php? What should I look for in a php info file (phpinfo();)?

Hope this is enough to get someone to help me, thanks in advanced for any help provided.



 6:54 pm on Jan 11, 2013 (gmt 0)

Could someone please help me here?


 6:55 pm on Jan 11, 2013 (gmt 0)

... sorry, double post.

brotherhood of LAN

 6:56 pm on Jan 11, 2013 (gmt 0)

Have you tried looking at the logging of your e-mail server, to see if it's receiving mail to handle?


 9:13 pm on Jan 15, 2013 (gmt 0)

Can't say I have, I'm on cPanel, would you mind telling me where should I look for this?

Thanks for the help :)

brotherhood of LAN

 9:27 pm on Jan 15, 2013 (gmt 0)

The /var/log/ folder if you're on a virtual/dedicated setup.

Alternatively try SSHing in and trying php from the command line using the -a flag and try mailing that way. Hopefully if you get an error message it can lead you further along to the answer.

Also try altering your script to have a line like touch('/createafile/here.txt'); ... then at least you can see that the script is being invoked.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved