Email Pipe PHP

Discussion in 'Installation/Configuration' started by slapstick, Dec 18, 2020.

Tags:
  1. slapstick

    slapstick New Member

    Hey everyone,
    I'm a bit stuck and need some help.
    I want to pipe all emails going to a subdomain to a PHP Script. So I created a subdomain and a catchall to deliver to a mailbox. I've heared something about seive pipe but don't know how to use it as I am new to that topic.
    Anyone got some tipps for me how to do it?
    Thanks
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Allowing any of your mail accounts to pipe to commands opens security issues for your server (though the idea is a possible solution), I would instead create a dedicated mail transport in master.cf to run your one command/script, and add an email route for the one email account to use that transport. Be careful in your scripting, as it's easy to create vulnerabilities that can then be explored by anyone sending you email.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    Or you let all emails deliver to a mailbox and then read the mailbox files from your script, either on the shell (less recommended) or by connecting to the mailbox by imap or pop3.
     
  4. slapstick

    slapstick New Member

    Thank you for the quick reply!
    Sounds like it's the perfect solution for my purpose. As I am learning and testing, can you give a short advice how to add a dedicated transport properly and how to use the route for specific domains? Would be great.
     
  5. slapstick

    slapstick New Member

    Now I created an entry in master.cf:
    Code:
    extpipe   unix  -       n       n       -       -       pipe
      flags=FR user=vmail argv=/path/to/script
    
    created a route in ISPConfig:
    Type: Custom
    Destination: "extpipe"

    And created an entry in Relay Recipients with @domain.com.

    My Problem now is, that I get an error:
    Code:
    warning: connect to transport private/["extpipe"]: No such file or directory
    I tried without quotes but no change.
     
  6. slapstick

    slapstick New Member

    Okay I solved my issues. Seems like there have to be no quotes in the route. and there was a permission problem with the file.
    Thank you guys for your help!
     

Share This Page