Cpanel 11 can't Pipe to script for email forwarding

rfresh

Registered
Jan 29, 2004
1
0
151
I'm using cPanel 11 on my website. I'm trying to create one forwarding email account ([email protected]) to pipe into a php script but the pipe isn't calling the script.

Here is my forwarding/piping syntax:

[email protected] to |/home/websitename/public_html/SMS.php

The script is set to 755.

I have other, regular forwards created and mail gets forwarded fine such as for sales, info, etc. to my hotmail account.

Here is the simple test script:

#!/usr/local/bin/php
<?php
mail('[email protected]', 'Subject', 'Message', 'From: [email protected]');
?>

The script works if I run it from a browser and it works if I run it from the command line in SSH - that is, I get the email message.

It just doesn't execute when the email comes in addressed to [email protected] and piped into this script.

I have other php scripts successfully using the mail() function so that is enabled on the server.

Since the script works from two sources and not as being piped from an incoming email, I suspect the problem is in the piping syntax.

I've discovered that the following syntax will work:

/usr/local/bin/php /home/mywebsite/public_html/SMS.php

but in cpanel ver 11, it strips out the first part (the php is located here). I was able to get this to work at my shared hosting provider but at my vps hosting provider they are using cpanel 11 and it won't take the string without stripping out the first part thus the piping won't work. Adding the hashbang in the script doesn't make it work.

Is there a workaround for this in cpanel 11?