email piping with qmail

Discussion in 'qmail' started by snowflake, Nov 18, 2013.

  1. snowflake

    snowflake Valued Member

    Joined:
    Nov 18, 2013
    Messages:
    11
    Likes Received:
    0
    I have an email address that is just a forward, so

    test@example.com just forwards to username@gmail.com


    In the .qmail file for test I have this:
    | /var/www/vhosts/example.com/httpdocs/info/api/pipe.php
    #| true
    &username@gmail.com


    The api script is set to 755 as well.



    When I send an email to test@ I get this error in the maillog

    Nov 18 16:24:45 servername qmail: 1384809885.825195 starting delivery 25495: msg 122093577 to local 7-test@example.com
    Nov 18 16:24:45 servername qmail-local-handlers[30150]: to=test@example.com
    Nov 18 16:24:45 servername qmail-local-handlers[30150]: mailbox: /var/qmail/mailnames/example.com/test
    Nov 18 16:24:45 servername qmail: 1384809885.831906 delivery 25495: deferral: /bin/sh:_/var/www/vhosts/example.com/httpdocs/info/api/pipe.php:_Permission_denied/


    AND with what I read on some issues, they said to add the php path to the script which i did in the qmail file like this:
    | /usr/bin/php /var/www/vhosts/example.com/httpdocs/info/api/pipe.php
    #| true
    &username@gmail.com



    And then I get this:
    Nov 18 16:30:10 servername qmail-queue-handlers[30602]: to=test@example.com
    Nov 18 16:30:10 servername qmail: 1384810210.706332 starting delivery 25527: msg 113348250 to local 7-test@example.com
    Nov 18 16:30:10 servername qmail-local-handlers[30606]: to=test@example.com
    Nov 18 16:30:10 servername qmail-local-handlers[30606]: mailbox: /var/qmail/mailnames/example.com/test
    Nov 18 16:30:10 servername qmail: 1384810210.764939 delivery 25527: deferral: Could_not_open_input_file:_/var/www/vhosts/example.com/httpdocs/info/api/pipe.php/
     


  2. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    9,001
    Likes Received:
    120
    After reading the first example my reply was going to be try what you did in the second example, ad the /path/to/php in front of the script name.

    Does the world have access to /var/www/vhosts/example.com/httpdocs/info/api/pipe.php ?

    Is that php trying to do anything with files?

    It it trying to read/write anything that wouldn't be accessible by the qmail users?
     

  3. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    9,001
    Likes Received:
    120
    This was fixed by:

    1. Fixing the permissions on the httpdocs folder so that qmail users could reach the api.php within that dir structure
    2. Removing the space between the pipe and the command
    After removing the space the first line of the .qmail file became:

    |/var/www/vhosts/example.com/httpdocs/info/api/pipe.php
     
  4. snowflake

    snowflake Valued Member

    Joined:
    Nov 18, 2013
    Messages:
    11
    Likes Received:
    0
    That issue you fixed last time where it was saying

    Could_not_open_input_file:_/var/www/vhosts/.....

    I thought it was just to chmod the httpdocs to 755 but that didn't work for this one.


    They upgraded my plesk because the update wouldn't work, so I had to redo this email piping.
     
  5. popowich

    popowich EQ Forum Admin Staff Member

    Joined:
    Aug 12, 2008
    Messages:
    9,001
    Likes Received:
    120
    This was needed to fix again:

    chmod 755 /var/www/vhosts/example.com

    Remove the space between the | and /path/to/php in the .qmail files

    "|/path/to/php" not "| /path/to/php"
     

Want to reply or ask your own question?

It only takes a minute to sign up (and it's free!). Click the orange sign up button to choose a username and then you can ask your own questions on the forum.
Loading...