Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i have a problem here.

I want that a incoming email is piped to a php script in the system through postfix.

My System is running with ispconfig 3, postfix and dovecot (< virtual mailbox users are saved in mysql).

I looked already into this one: How to configure postfix to pipe all incoming email to a script?

... the script is executed, but no "message" is delivered to the script. My setup so far:

In ISPConfig 3 i have set up the following email route:

Active      Server          Domain              Transport   Sort by
Yes    piper:      5

excerpt from my postfix

piper   unix  -       n       n       -       -       pipe
    user=piper:piper directory=/home/piper argv=php -q /home/piper/mail.php

so far it is working great (mail sent to (mail.log):

Jun 21 16:07:11 example postfix/pipe[10948]: 235CF7613E2: to=<>, relay=piper, delay=0.04, delays=0.01/0.01/0/0.02, dsn=2.0.0, status=sent (delivered via piper service)

... and no errors in mail.err

the mail.php is sucessfully executed (its chmod 777 and chown'ed to piper), but creates a empty .txt file (normally it should contain the email message):

-rw------- 1 piper piper    0 Jun 21 16:07 mailtext_1340287631.txt

the mail.php script ive used, is the one from

if i use their (commercial) service to pipe an email to the mail.php (in a apache2 environment) through a provided "pipe-email", the message is saved sucessfully and complete. But as you can see, i dont want to use external services.

-rw-r--r--  1 web2 client0  1959 Jun 21 16:19 mailtext_1340288377.txt

So, whats wrong here? I think it has something to do with the "delivering configuration" in my system...

share|improve this question
up vote 0 down vote accepted

That is because your PHP-Script is crap. It doesn't save STDIN to the file. It instead saves a non-initialized (empty) variable to a file. This is why it is empty.

You should learn PHP to solve the problem.

share|improve this answer
And why it is working when i use the Service (Destination set to the mail.php, like This doesnt make sense to me. – carrot Jun 22 '12 at 6:52
So, i wrote a short bash script to save stdin to a file. the command echo testing | /home/piper/ sucessfully creates a stdin.txt with the content "testing", but execute this one via piper: transport, it creates again a empty stdin.txt file. – carrot Jun 22 '12 at 8:44
Another update... this one works:… – carrot Jun 22 '12 at 8:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.