John's suggestion of using an ACL variable along with the global rewrite
doesn't work (I think that's what he tried to say himself afterwards).
The address is already rewritten by the time the acl variable is set. I
used this under acl_check_rcpt:
warn local_parts = ^[.]\+onbehalf\$
set acl_c1 = foo
And then this router:
onbehalf:
driver = redirect
condition = ${if eq{acl_c1}{foo}}
data = root@???
unseen
no_verify_sender
Here is the debug output of sending an email from root@??? to
SNIPPED+gmail.com+onbehalf@???
http://pastebin.com/Je86Uvca
Note how early the global rewriting happens (first 140 lines). Also note
at line 138 that it says:
>>Headers after rewriting and local additions:
...
* X-rewrote-original-recipient: SNIPPED+gmail.com+onbehalf@???
That X- header doesn't appear to exist/be accessible in a router though.
To all more experienced Exim users: I'd expect that a sophisticated
software such as Exim to have a mechanism allowing me to detect that a
global rewrite took place. It can't be that there is no trace of an
address being rewritten by a global rewrite, can it? (if that's the
case, then I think this is a useful feature to add)
So my question is: How can I detect that a global rewrite took place
somewhere after it happened (e.g. in a router)?
An answer to that would basically solve my problem.
Thanks for all the help so far,
Alex.