Re: [exim] Redirect route data variable expansion

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Jakob Hirsch
Date:  
À: exim-users
Sujet: Re: [exim] Redirect route data variable expansion
On 13.03.2011 19:58, Matthias-Christian Ott wrote:

> Everything seems to work so far except that I was not able to filter
> addresses from the CC header in data. My idea was something like this:
>
> ${filter{a@???, b@???, c@???}{and {{def:h_Cc}}{{!eq{$item}{$h_Cc}}}}}


You did not state what you want to achieve. I guess you want to get
if the CC header contains one of the addresses. Some comments:

- As you already wrote, ${filter wants a colon separated list, but you
can change this "in the usual way", e.g. ${filter {<, a, b, c...
- you have too much closing braces } in your condition. It should look
like: ${filter {... list ...} {and {{condition1}{condition2}...}}}
- You should not put the def:h_CC in the filter condition, as it would
have to be checked for every list item this way (not a big deal, though,
just some wasted CPU cycles). That means you would have to put an ${if
around the filter
- when using $h_something, you should always add the terminating colon
":", as in "$h_cc:". As the spec says:
"Header names follow the syntax of RFC 2822, which states that they may
contain any printing characters except space and colon. Consequently,
curly brackets do not terminate header names, and should not be used to
enclose them as if they were variables. Attempting to do so causes a
syntax error." This is probably the reason you are getting the error
message. We should probably make the colon mandatory in a future version
and warn about it in the mean time...
- What you want to will not work this way.
First, the CC header contains RFC 2822 addresses ("some person
<sp@???>"), so you'd have to use ${address: to extract the
address itself.
Second, the CC header may contain more than one address. That means you
will have to use a inner loop where you iterate over the CC addresses.
You can use the ${addresses: operator to get a colon separated list.
Unfortunately, I don't know how to get the $item of the outer loop. You
could put your addresses in a file and use a lsearch lookup.

The whole thing would then look like this (untested and with line breaks
for readability):

${if {def:h_Cc} {
  ${filter
    {${addresses:$h_cc:}}
    {lsearch;/path/to/address/file}
  }}
}