I want to forward emails to a PHP script if thats possible...
I want to emails sent to admins@-------.x10.mx to be readable with PHP script...
I'm new also so you might have to explain stuff...
I want to forward emails to a PHP script if thats possible...
I want to emails sent to admins@-------.x10.mx to be readable with PHP script...
I'm new also so you might have to explain stuff...
You will have to go to CPanel -> Mail -> Account level filtering -> Create new filter. Set the rule name to whatever you want, then filter based on "to" "equals" fill in admins@-------.x10.mx in the box. Set the action to "pipe to a program" fill in /home/tenx23/path/to/your/file.php, in example. You may want to add another action to "discard message" or else the message will also be delivered to the inbox. Finally, if your php file does not start with a hashbang, this is unlikely to work. The hashbang is #!/usr/bin/php -q. So, your file should look like this:
I haven't done this before, so you may need to do some google searching yourself to get all the answers.Code:#!/usr/bin/php -q <?php // code starts here like normal ?>
Last edited by garrettroyce; 03-27-2011 at 12:12 PM.
gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer
Thanks! Incase anyone is interested, you can read the email with this PHP code:
Note: After you got the email you have to parse through the headers and all that!Code:#!/usr/bin/php -q <?php // read from stdin $fd = fopen("php://stdin", "r"); $email = ""; while (!feof($fd)) { $email .= fread($fd, 1024); } fclose($fd); ?>
This site helped me out: http://www.damnsemicolon.com/php/par...-piping-part-2
Hmm I get the same Can't do setuid() (sperl) like I do with the autoresponder...
It was escalated so hopefully when they fix that it'll apply to this aswell...