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

Visit PubCon.com
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
Sub_Seven




msg:4534882
 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
<?php

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


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

|/home/username/public_html/pipe/script.php

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.

 

Sub_Seven




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

Could someone please help me here?

Sub_Seven




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

... sorry, double post.

brotherhood of LAN




msg:4535348
 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?

Sub_Seven




msg:4536300
 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




msg:4536303
 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