[Exim] Exim an external applications

Pàgina inicial
Delete this message
Reply to this message
Autor: Boris Penck
Data:  
A: exim-users
Assumpte: [Exim] Exim an external applications
Hi there

The few past days I played around with piping mails from exim to php
and pack. Goal is to parse end evaluate each mail with a PHP script
and return it to exim to deliver the mail to the users mailbox.

Transport:
----------

mailfeed:
driver = pipe
command = "/path/to/my/application ${sender_address} ${pipe_addresses}"
prefix =
suffix =
check_string =
escape_string =
# for debugging change return_output to true
return_output = true
return_path_add = false
user = mail
group = mail
path = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
current_directory = "/tmp"

Director:
---------

mailfeed_director:
condition = "${if eq {$received_protocol}{php-parsed} {0}{1}}"
driver = smartuser
transport = mailfeed

At the beginning everything works fine. The mail is piped to my (PHP)
application and the command line arguments are working also.

After my application is done, it should return the mail to exim to
deliver every mail to its receiver.

shell_exec("/usr/sbin/exim -oMr php-parsed -i $sender $recpt");

The mail reaches exim again right. But now, I'm in an endless loop.
It's piped between exim an my application again and again.

( Well, for inspirations I get the methods from spamassassins settings,
which works perfect this way )

With -oMr in the exim call I set a protocol name which I will check in
Exim. If present - do not use the Director. But somehow it's ignored
and the mail runs through th e director every time without end.

Any suggestions ?
-boris