Welcome to WebmasterWorld Guest from 23.22.207.70

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Email piping not working

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

Junior Member

5+ Year Member

joined:June 18, 2010
posts: 167
votes: 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.
6:54 pm on Jan 11, 2013 (gmt 0)

Junior Member

5+ Year Member

joined:June 18, 2010
posts: 167
votes: 0


Could someone please help me here?
6:55 pm on Jan 11, 2013 (gmt 0)

Junior Member

5+ Year Member

joined:June 18, 2010
posts: 167
votes: 0


... sorry, double post.
6:56 pm on Jan 11, 2013 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4842
votes: 1


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)

Junior Member

5+ Year Member

joined:June 18, 2010
posts: 167
votes: 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 :)
9:27 pm on Jan 15, 2013 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
posts:4842
votes: 1


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.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members