Postfix "mail-to-script" pipe only delivers empty messages

Posted by user68202 on Server Fault See other posts from Server Fault or by user68202
Published on 2012-06-21T14:33:47Z Indexed on 2012/06/21 15:17 UTC
Read the original article Hit count: 295

Filed under:
|
|
|

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         example.com     pipe.example.com    piper:      5

excerpt from my postfix master.cf:

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 [email protected]) (mail.log):

Jun 21 16:07:11 example postfix/pipe[10948]: 235CF7613E2: to=<[email protected]>, 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 http://www.email2php.com/HowItWorks

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...

© Server Fault or respective owner

Related posts about php

Related posts about email