1

Topic: External PIPE to PHP script

Hello!

I prepare:
iRedMail v0.7.3:
Debian
with postfix, dovecot and I have now a problem,
I have SMS box to send information about new mail, when I do like this:
1) create second account like: me_sms@domain.com where is always send copy of original mail from me@domain.com when mail arrived.
2) Do like in FAQ: http://iredmail.org/wiki/index.php?titl … nal.Script
- Create in main.cf
transport_maps = hash:/etc/postfix/transport
postmap hash:/etc/postfix/transport

In transport I write:

me_sms@domain.com external-pipe

In main.cf do at end of file:
external-pipe unix - n n - - pipe flags= user=vmail:vmail argv=/home/me/me.sh

In me.sh I have:

php5 -c /etc/php5/apache2/php.ini -f /var/www/newmail.php

In newmail.php I have script to send SMS, and write log to other file,

My first question is how to get data from mail like FROM, TOPIC, CONTENT (I wont to send first 50 chars of new mail as preview)

And second question, why this file dosn't wotk I mean nothing is runing this file.
No other log file is creating, but if this PHP file Was run it must be create.

In log file I have no error, and in info file I have:
status=sent (delivered via external-pipe service)

I don't understand this how delivered if this file Was not runing ?

I try to original mailbox as me@domain.com but then file is not running too but original mail is not go to my mailbox but disappear, in logs then i have this same info about delivered via external-pipe.

Please help!

Best regards!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: External PIPE to PHP script

mateuszjmmsoft wrote:

My first question is how to get data from mail like FROM, TOPIC, CONTENT (I wont to send first 50 chars of new mail as preview)

Postfix will pipe whole email as character stream to external script, just like read an email message with command "cat", "less". So, please make sure your script "/home/me/me.sh" can read them from stdin, like this:

$ cat <<EOF | /home/me/me.sh
From: User Name <user@domain.ltd>
To: User Name2 <user2@example.com>
Subject: Hello mateuszjmmsoft

Mail body starts after a blank line.
EOF
mateuszjmmsoft wrote:

And second question, why this file dosn't wotk I mean nothing is runing this file.
No other log file is creating, but if this PHP file Was run it must be create.

In log file I have no error, and in info file I have:
status=sent (delivered via external-pipe service)

If you get similar log, it means pipe works as expected. The problem is your script.