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 [email protected] delivered to [email protected] (yes I know it's prone to open relay). I'm using this global rewrite pattern under "begin rewrite" to do that:

\N^([^+]+)\+([^+]+)\[email protected]$\N   $1@$2   Ttcb

Works fine, messages are indeed delivered to [email protected].

But I want such emails to also be copied to [email protected], 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 [email protected]\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: [email protected]
T To: [email protected]
  Subject: test routing
I Message-Id: <[email protected]>
* X-rewrote-original-recipient: [email protected]
F From: [email protected]
  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 [email protected]\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 [email protected]\nendif
expanded: #Exim filter
if "" contains "+onbehalf"
then deliver [email protected]
endif

Any clues would be greatly appreciated.

Alex.

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

Reply via email to