The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Cpanel 11 can't Pipe to script for email forwarding

Discussion in 'E-mail Discussions' started by rfresh, Mar 12, 2008.

  1. rfresh

    rfresh Registered

    Joined:
    Jan 29, 2004
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    I'm using cPanel 11 on my website. I'm trying to create one forwarding email account (wx2@mywebsite.com) to pipe into a php script but the pipe isn't calling the script.

    Here is my forwarding/piping syntax:

    wx2@mywebsite.com 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('myaccount@hotmail.com', 'Subject', 'Message', 'From: wxod@mywebsite.com');
    ?>

    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 wx2@mywebsite.com 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?
     
Loading...

Share This Page