Postfix won't pipe to PHP file through aliases file

Posted by jfreak53 on Server Fault See other posts from Server Fault or by jfreak53
Published on 2012-11-02T19:41:24Z Indexed on 2012/11/02 23:04 UTC
Read the original article Hit count: 337

Filed under:
|
|
|

I'm trying to pipe from postfix to a command. According to Postfix logs it worked, but when I check the command it didn't. This is a fresh postfix install. This is my alias file:

# See man 5 aliases for format
postmaster:    root
support:  "| /usr/bin/php -q /var/www/pipe/pipe.php"

I run sendmail [email protected] then type it and then on a separate line type . and it goes. I check the postfix log /var/log/mail.log and this is what it states:

Nov  2 15:32:33 server3 postfix/local[13284]: 42C429E0B5: to=<[email protected]>, relay=local, delay=156, delays=156/0.01/0/0.05, dsn=2.0.0, status=sent (delivered to command:  /usr/bin/php -q /var/www/pipe/pipe.php)

So according to that it worked, but it doesn't. If I run echo 'text' | /usr/bin/php -q /var/www/pipe/pipe.php it does work just fine.

Any ideas what I did wrong?

I know piping is working, I originally checked it by running that command above WITHOUT the quotes, so just support: | /usr/bin/php -q /var/www/pipe/pipe.php What it did there was append my email header and all to the file pipe.php. So I know postfix was piping it, but when I put in the quotes it says it's going but it's not according to my script.

© Server Fault or respective owner

Related posts about php

Related posts about postfix