Hello everyone
I've spent at least 2 days trying to figure out what is wrong with my configuration to pipe an email to a php script. I've tried dozens of combinations and no errors or logs are being generated.
I'd really appreciate some feedback on how to walk throught the config so I could find what is wrong with my setup.
My first question would be about the field "pipe to a program" in the e-mail filter...
Should we use the full path of the script or just the relative path? Should we also use the pipe sign at the very beggining or not? I've tried all the combinations 😞
|/home/xxx/public_html/path_to_script/script.php or
|/public_html/path_to_script/script.php or
/home/xxx/public_html/path_to_script/script.php or
public_html/path_to_script/script.php or
????
Thanks
Solved! Go to Solution.
I found the following information when I just googled for this....
In some cases you might need to redirect a given mailbox to a PHP script to handle the incoming messages. This can be easily done with cPanel -> Forwarders tool.
To set up pipe forwarding, you can follow the steps below:
- Log in to your cPanel;
- Click on the Forwarders icon, under the Mail section;
- Click on the Add Forwarder button;
- Fill in Address to Forward and put the mail address you would like to pipe the messages from.
- Click on the Advanced options link and select Pipe to a Program. Then fill in the full path to the script which will handle the messages. If you create a script/file called pipescript.php placed inside your home folder you should fill in /home/username/pipescript.php inside the Pipe to a Program field. If the script is situated inside the public_html/ folder you should fill in /home/username/public_html/pipescript.php
There are several important things you should check regarding the PHP script which is handling the email messages:
#!/usr/local/php70/bin/php-cli -q
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
I found the following information when I just googled for this....
In some cases you might need to redirect a given mailbox to a PHP script to handle the incoming messages. This can be easily done with cPanel -> Forwarders tool.
To set up pipe forwarding, you can follow the steps below:
- Log in to your cPanel;
- Click on the Forwarders icon, under the Mail section;
- Click on the Add Forwarder button;
- Fill in Address to Forward and put the mail address you would like to pipe the messages from.
- Click on the Advanced options link and select Pipe to a Program. Then fill in the full path to the script which will handle the messages. If you create a script/file called pipescript.php placed inside your home folder you should fill in /home/username/pipescript.php inside the Pipe to a Program field. If the script is situated inside the public_html/ folder you should fill in /home/username/public_html/pipescript.php
There are several important things you should check regarding the PHP script which is handling the email messages:
#!/usr/local/php70/bin/php-cli -q
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community
Hi, thanks for your reply.
It's not working yet 😢
Do you know if any log is generated by PHP that I could check?
I've printed in a simple php file that the PHP binary is located in /usr/local/bin/lsphp so i tried both #!/usr/local/bin/lsphp -q and #!/usr/local/bin/lsphp-cli -q but it's still not working
Thanks again
Leo
In regards to a log - not sure as I've never tried this
Re: PHP 7.1 it would just be changing 70 to 71 in the path
Once your issue is resolved,
please be sure to come back and click accept for the solution
Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community