[exim] help with redirect router and filter after header rew…

Top Pagina
Delete this message
Reply to this message
Auteur: Alex Roman
Datum:  
Aan: Exim-users
Onderwerp: [exim] help with redirect router and filter after header rewrite
Hi,

I'm hoping a kind soul can help. I did read docs and made some steps,
but am a bit stuck and am also new to Exim.

Exim is handling mail for mydomain.com. I managed to have emails sent to
user+gmail.com+onbehalf@??? delivered to user@??? (yes I
know it's prone to open relay). I'm using this global rewrite pattern
under "begin rewrite" to do that:

\N^([^+]+)\+([^+]+)\+onbehalf@???$\N $1@$2 Ttcb

Works fine, messages are indeed delivered to user@???.

But I want such emails to also be copied to admin@???, where
"admin" is an alias for "root" in /etc/aliases. This is where I'm stuck.

I tried with a redirect router:

onbehalf:
     debug_print = "R: copy onbehalf messages"
     driver = redirect
     data = #Exim filter\n\
         if "$h_to:" contains "+onbehalf"\n\
         then deliver admin@???\n\
         endif
     allow_filter
     #check_local_user
     user = root
     #unseen


According to the debug output, the filter in this router fails because
the address has already been rewritten before the router is executed.
Doesn't matter if it's the first router after "begin routers" or last.

Looking at the debug output, I see that Exim reports adding a useful
X-rewrote-original-recipient header:

>>Headers after rewriting and local additions:

* To: SNIPPED+gmail.com+onbehalf@???
T To: SNIPPED@???
Subject: test routing
I Message-Id: <E1UuRrd-0005tY-4S@???>
* X-rewrote-original-recipient: SNIPPED+gmail.com+onbehalf@???
F From: root@???
Date: Wed, 03 Jul 2013 20:33:13 +0200

I tried to change the redirect filter to the following:

     data = #Exim filter\n\
         if "$h_X-rewrote-original-recipient:" contains "+onbehalf"\n\
         then deliver admin@???\n\
         endif


But the debug output reports that X- header to be empty "":

--------> onbehalf router <--------
local_part=SNIPPED domain=gmail.com
R: reply to mydomain.com review invitation
calling integru_invitereply router
rda_interpret (string): #Exim filter\nif
"$h_X-rewrote-original-recipient:" contains "+onbehalf"\nthen deliver
admin@???\nendif
expanded: #Exim filter
if "" contains "+onbehalf"
then deliver admin@???
endif

Any clues would be greatly appreciated.

Alex.