Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 test@pipe.example.com) (mail.log):

Jun 21 16:07:11 example postfix/pipe[10948]: 235CF7613E2: to=<test@pipe.example.com>, 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...

share|improve this question
add comment

1 Answer

up vote -1 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 email2php.com Service (Destination set to the mail.php, like example.com/mail.php)? This doesnt make sense to me. –  at0m33 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/stdin.sh sucessfully creates a stdin.txt with the content "testing", but execute this one via master.cf piper: transport, it creates again a empty stdin.txt file. –  at0m33 Jun 22 '12 at 8:44
    
Another update... this one works: daniweb.com/web-development/php/threads/318306/… –  at0m33 Jun 22 '12 at 8:58
add comment

Your Answer

 
discard

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.