0

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

carrot
  • 77
  • 1
  • 1
  • 10

1 Answers1

-1

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.

mailq
  • 16,882
  • 2
  • 36
  • 66
  • And why it is working when i use the http://www.email2php.com/ Service (Destination set to the mail.php, like http://example.com/mail.php)? This doesnt make sense to me. – carrot Jun 22 '12 at 06: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. – carrot Jun 22 '12 at 08:44
  • Another update... this one works: http://www.daniweb.com/web-development/php/threads/318306/pipe-email-to-php – carrot Jun 22 '12 at 08:58