3

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.

1 Answer 1

3

I was only missing one line in my /etc/postfix/main.cf file.

default_privs = www-data 

Which is weird since I tried running as 777 the file, so in theory it should have worked. Oh well it works this way now. So in short set privs of the owner of the file since Postfix defaults to user nobody.

2
  • I have to wait two days after posting my own answer to accept my own as the answer :( Commented Nov 3, 2012 at 14:02
  • 1
    Thank you @jfreak53. I was looking for this for long time .. thank you! +1 Commented Mar 22, 2018 at 12:15

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.