Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2007
    Location
    Los Angeles
    Posts
    545
    Thanks
    81
    Thanked 5 Times in 5 Posts

    Need to Pipe incoming email to PHP script

    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 can't think of anything else ???
    RalphF
    Business Text Messaging Services
    https://www.MobileTextingService.com

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    The script doesn't execute at all? Post the command you use when you pipe it to the script. Have you tried var_dump($argv);, or the return from mail() or echo()'ing a message?

    Have you read the PHP command-line docs?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •