-
Posts
143 -
Joined
-
Last visited
Everything posted by Russ
-
I am stumped. I know that this isn't a php site or forum, but I thought that perhaps someone might be able to point out where I am running afoul. I have spent many hours over the last few days trying to figure out how to pipe an email from my TCH domain to a php script so that the script could process it. I have the following code for my script: > #!/usr/bin/php-q <?php // read from stdin $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); // handle email $lines = explode("\n", $email); // empty vars $from = ""; $subject = ""; $headers = ""; $message = ""; $splittingheaders = true; for ($i=0; $i < count($lines); $i++) { if ($splittingheaders) { // this is a header $headers .= $lines[$i]."\n"; // look out for special headers if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) { $subject = $matches[1]; } if (preg_match("/^From: (.*)/", $lines[$i], $matches)) { $from = $matches[1]; } } else { // not a header, but message $message .= $lines[$i]."\n"; } if (trim($lines[$i])=="") { // empty line, header section has ended $splittingheaders = false; } } mail('Me@MyDomain.net', $subject , $message); ?> I have: Configured email forwarding for one of the email addresses for my domain (adc@xyz.net) using cPanel - setting the destination as "Pipe to a Program." Upload and tried the script in cgi-bin and another directory. Set permissions to 755. Tested the script by having it read a from a file (rather than having data piped to it via email) and to works. Tested the script with "#!/usr/bin/php-q", "#!/usr/bin/php -q" and "#!/usr/bin/php" as the Hashbang, all with no luck. But, alas the script does not work. Each time I have forward an email to the email address (adc@xyz.net) that is configured to pipe to the script, I get the following bounce back email: Moreover, no email is sent to Me@MyDomain.net ( the final action of the script). Does anyone have any suggestions as to what I am missing? Any help would be appreciated. Thanks. Russ
-
Thanks,again, Bruce. For my edification, would running phpinfo() have told me the "the path to the interpreter"? I am trying to learn my way around things better, and to peice together how php is installed and configured on TCH. Also, I have been searching for more info on how the piping works and came accross this older thread on TCH forums - Run Php Script To Parse E-mails (from 2004/05). It seems to suggest the use of email filtering rather than email forwarding. I assume that cPanel has changed since the date(s) of that thread and that forwarding is the proper way to accomplish this now on cPanel? BTW - It is interesting...the above thread talks about the exact topic that I have been trying to read up on, but when I searched the TCH forums, it did not come up - or at least it did not come up anywhere near the top of any of the 200+ results yeilded by each of my numerous queries on the forum search field. I discovered the thread on the sixth page of a google seach for "php tutorial stdin pipe" - I was trying to read up on "STDIN" and "php://stdin" and how they related and should be used with piping. I must not be using the seach function correctly, or otherwise it must not be very functional/useful, as it doesn't seem to filter results very well (gives whay to moany and too many that seem off-point) - given my techncal prowess, I'd probably chalk it up to user error! Thanks, again.
-
Thanks, Bruce. I am curious, is the "the path to the interpreter" the directory on the server where php is installed? Also, does it matter where the script is saved? Does it need to be on cgi or scgi, or can I put it into another directory? Some information I have been looking at on the internet suggests that for security purposes, I should not put it in my /public_html directory. Thanks, again. Russ
-
I am trying to write a php script that will read and process an email. I want to pipe an email to that script. I am loading the script to my cgi folder and giving it permissions of 755. I am then setting up an email forwarder in cPanel and selecting the "Pipe to Program" option. That option includes the following instructions: As instructed, I inserted path to my script, which is: My script is not working. When I send a test email to the address that is forwarded to the script, I get a bounce back email that states, in part: I am trying to figure out where I am going wrong. 1. Assuming that the script is properly written (from a syntax and logic standpoint), am I setting up this properly on my site? As far as uploading the script to my cgi folder? Also tried it in my scgi folder and in a "test" folder created in my /public_html folder. Neither of these of those work. 2. I am not sure what to use for the "Hashbang" and contrary to the instructions quoted above, when I set up the forwarder, I was not "prompted to have the Hashbang added automatically." I have spent a several hours researching this but have not been able to fix. So I wanted to make sure it wasn't something in the way I have things set up in cPanel. Thanks in advance for any assistance. Russ
-
Problem with cPanel is that you can only do one file at a time. I was curious as to how the windows web publisher wizard worked with flickr, gallery2, etc. I had originally posted to see if anyone had looked into this, and then as I spent more time on it I found some information, so I thought I would post it.
-
Meant to post the links that I found - Microsoft in on Web Publishing Wizard - Some general information on the wizard. Entering the Registry Keys - I was able to work thru this, and My domain shows up in the wizard Information on the Server-side script/programing - This totally lost me
-
Well found some info...looks very complicated and requires editing the registry.
-
I did some "googling" and it seems that the sites that allow you to upload with the "publish this file to the web" link in the left panel of My Computer windows xp require you to download a file that gets added to your registry...flickr and gallery and other online photo sharing sites use this approach...anyone have any idea what these registy file entail and where one could read up on the process?
-
Thanks, guys....that worked!
-
On several of my online photo accounts (for example flickr), I can use the "web publishing wizard" in windows xp to upload photo files....is there any way to do this with my tch domain?
-
Thanks...which htaccess file ....the one in my root?
-
Thanks, but I am still confused. When something says that a file or a folder is "owned" by "Nobody," what does that mean?
-
I am playing around with Wordpress and I am trying to set up a plug in called NextGen- it is a plug in for a photo gallery. I have it installed and activated, and I have uploaded photos. The photos can be viewed. The problem is this: the plug-in will create thumbnails, but when I attempt this I get this error message: Searching the WP forums, it seems that this is a function of a memory limitation on my domain (for example). Anyone have any idea what this means, and if there is a work around (for example, a way to raise memory limitation), other than reducing size of image file (that has been suggested on the wp forum)?
-
That was helpful...but how does the "nobody" user work?
-
Can someone refer me to link or a prior thread that would explain to me how permissions work on tch? I want to understand who is the "user" or "owner" of the different files and folders on my domain/account? When is it me? When is it "nobody?" How do I create groups, etc. I find this confusing...when I am setting up things like gallery2 and wordpress, I am being instructed to set permissions to "such and such" - and I'd like to understand what that means and the potential consequences? Thanks.
-
Thanks...but what permissions would make it so that Gallery can write to the files but that others cannot?
-
Bruce - When I attempt to create the directory /home/username/g2data in cPanel file manager, nothing happens...it isn't created? EDIT: Well now it is showing up! But, how do I set permissions...see post #7? Thank you.
-
Another follow up question, if I may....With respect to this directory, the Gallery2 documentation (linked above) says: How do I do this?
-
Thanks. I am installing Gallery 2. The install instructions (Gallery 2 Install Documentation) state in part as follows: Note - I tried installing thru fantastico, and fantastico puts the directory to store photos in the web root.
-
Not sure if this is the correect place to post, but my forum account is acting strange....it says I have a message, but there are no messages (new, old, sent or otherwise)?
-
I am installing a file on my site...the installation instructions state that "...for security reasons we suggest that you do not put it in the web root." On cPanel, if my domain is "www.****" what is my web root, and where would I install the subject file?
-
Thanks...so the email (and any attachments) is deleted and does not take up any quota space?
-
I have set up a "user level filtering"rule that discards certain emails. Whenever I save rule, the rule changes. Instead of discarding email the rule now says that the email should be converted to a "deliver to folder" rule. The folder is "/dev/null." Likewise, I have an alternative rule (for same email address) that forwards certain emails to another address. Again, when I save this rule, another action is added to to a "deliver to folder" rule. The folder is "/dev/null." Why does this need to be to a "deliver to folder." Why can't I just discard the email? Also, where is the folder "/dev/null." I do not see it in my list of folders under CPanel File Manager? Thanks.
-
Think I solved this. The above script does not generate any headers ("to", "from" or "subject"). Apparently tch's smtp server rejects that the email if it does not have headers. If you add same to the text file that comprises the body of the email, it works!
