Re: [exim] Adding a per-recipient message header

Top Page
Delete this message
Reply to this message
Author: Mike Cardwell
Date:  
To: exim-users
Subject: Re: [exim] Adding a per-recipient message header
* on the Sat, Oct 14, 2006 at 02:17:37AM -0700, SeattleServer.com wrote:

> So I've got a big problem, and from what I'm able to gather of Exim's design
> decisions, there's no easy way around it.
>
> Without going into excessive detail, I generate a unique identifier for every
> pass of the RCPT ACL, and stick it into $acl_m4. I record a bunch of stats
> into a database based on this number so that I can look up details of what
> exactly happened later.
>
> Towards the end of the ACL, before any rejection or accepting takes place, I
> have the following:
>
>         warn    add_header      = :at_start_rfc:X-SeattleServer-ID: 
> ${acl_c6}-${acl_m6}-${acl_m4}

>
> Well, if I then send a message two two recipients, instead of having one
> unique line per actual copy of the message, both messages contain the
> following in the headers:
>
> X-SeattleServer-ID: 380105-22910-24043
> X-SeattleServer-ID: 380105-22910-24042
>
> This isn't very useful because I do a lot of stuff differently based on who
> the recipient is and what settings they have - I need each identifier in the
> ONE copy of the message it pertains to.


What would be nice is if you could have a hash style variable so you could
connect a recipient with an ID. Then in the routers you could add the header
depending on the recipient using "headers_add"

You can do this, by emulating/hacking a hash:

In the rcpt acl:

warn set acl_m4 = $acl_m4\n$local_part@$domain=YOUR_UNIQUE_ID

In the router:

headers_add = X-SeattleServer-ID: ${extract {$local_part@$domain}{$acl_m4}}

Let me know if it works for you. I've never seen anyone other than my
self use this hack in an exim configuration. There's probably some evil
reason that makes this method "wrong". But it still works.

Mike