Re: [exim] FW: Piping all outgoing mail to a PHP script

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Peter Velan
Dátum:  
Címzett: exim-users
Tárgy: Re: [exim] FW: Piping all outgoing mail to a PHP script
am 10.01.2008 13:23 schrieb Scott McNaught:
> Hello,
>
> I am trying to pipe all outgoing SMTP mail to a php script. I have full root
> access to the server, and changes can be made system wide via exim.conf.
>
> Has anyone got any examples that do anything similar to this?


I'm doing similar things, but with Perl.

After some ACL-fiddling, I'm getting the indicator: "do it with the
script" and my router ...

# special script router
#
rr_script:
driver = accept
transport = tt_script
condition = ${if match {$header_X-ACL-script:} {\N^(?i)xyz.*\N} }
no_more

... says: "use script transport", which looks like ...

# script transport
#
tt_script:
driver = pipe
envelope_to_add
delivery_date_add
user = (scriptowner)
group = (groutp_of_scriptowner)
command = /opt/mex/bin/mex.pl -log=y -eml=y -xpl=n - -

... now the perl script perfoms his dirty work and reinjects a modified
message into exim, with ...

# (last action of perl script)
#
# value of envelope from ------------------------------+
# set envelope from --------------------------------+  |
# single dot does terminate --------------------+   |  |
# get recipients from input -----------------+  |   |  |
# value of $authenticated_id -----------+    |  |   |  |
# set $authenticated_id -----------+    |    |  |   |  |
# accept message on stdin -----+   |    |    |  |   |  |
#                              |   |    |    |  |   |  |
open MAIL, "| /usr/sbin/exim4 -bm -oMai xxx -t -oi -f '<x@???>'";
$mail->print( \*MAIL );
close MAIL;



Works great!


HTH,
Peter