Re: [exim] Run a shell script from transport?

Pàgina inicial
Delete this message
Reply to this message
Autor: Lena
Data:  
A: exim-users
Assumpte: Re: [exim] Run a shell script from transport?
> From: Nils Altenbach

> I want exim4 to run a shell script every time the transport
> local_mysql_delivery delivers a mail, with the username of the user
> receiving the mail (local part of the email address) as argument for
> that script.
>
> I've tried using the transport_filter, but it doesn't work.
>
> This is the transport in question:
>
>
> local_mysql_delivery:
>    driver        = appendfile
> #  file         = /var/mail/$local_part
> #  directory    = /home/$local_part/.maildir
>    directory     = /var/mail/${domain}/${local_part}/
>    maildir_format
>    delivery_date_add
>    envelope_to_add
>    return_path_add
>    user          = mail
>    group         = mail
>    mode          = 0660

>
>    # running the delivery alert script

>
> # transport_filter = /bin/sh -c /usr/local/bin/maildelivered.sh
> '${quote_mysql:$local_part}'


transport_filter = /bin/sh -c '/usr/local/bin/maildelivered.sh ${quote_mysql:$local_part}'

But a transport filter must copy its standard input to its standard output
(optionally with modifications). Instead I use "unseen" in the router and
an additional router with a pipe transport.

> The transport filter is commented out because if I use it, mails aren't
> delivered, and /var/log/exim4/mainlog gives me something like this:
>
> 2010-12-03 16:51:25 1POXtY-00035P-2l == abc@??? R=mysql_user
> T=local_mysql_delivery defer (-24): transport filter process failed
> (127) while writing to tmp/1291391485.H362240P11945.fooserver.net:
> unable to execute command
>
> What am I doing wrong? Should I use run instead of transport_filter, and
> how exactly am I supposed to run a shell script from a transport? I
> don't need any feedback from that shell script (other than it did run
> without errors), I just need exim to run that script every time a MySQL
> user receives a mail.