Re: [Exim] rewriting, redirecting, and the sendmail "+ hack"

Etusivu
Poista viesti
Vastaa
Lähettäjä: Kirill Miazine
Päiväys:  
Vastaanottaja: Noah Meyerhans
Kopio: exim-users
Aihe: Re: [Exim] rewriting, redirecting, and the sendmail "+ hack"
Noah Meyerhans wrote:
> > You can use a router for that. More elegant and a lot simpler.
> >
> > redirect:
> >     driver = redirect
> >     <some conditions here>
> >     local_part_suffix = +*
> >     local_part_suffix_optional
> >     data = ${quote:$local_part$local_part_suffix}@<lookup the domain>

>
> Except you're assuming that the local-part is the same in my domain as
> it is at the final destination, aren't you? That's not a valid
> assumption in this case. You could very well see
> noahm: nlm@???
> and that wouldn't work with your redirector. That's why I'm making two
> dbm lookups: I need to find the local-part of the final recpient in
> addition to the domain.
>
> Or am I misunderstanding what's going on here?


I was. You could lookup the local part too. But that would require two
lookups anyway.

A (possible) solution that will require only one lookup. Have one lookup
map of with the entries of the form:

    user:   ${quote:foo$local_part_suffix}@???
                    ^^^ <- new local part  ^^^^^^^^^^^^^^^ <- new domain


And a router:

redirect:
    driver = redirect
    domains = ...
    local_part_suffix = +*
    local_part_suffix_optional
    data = ${expand:${lookup{$local_part}dbm{/path/to/map.db}}}
    qualify_preserve_domain


Only one lookup, but quite an ugly map.

Another format for a lookup map could be:

    user:   local_part=foo  domain=bar.example.com


And a corresponding router:

redirect:
    driver = redirect
    domains = ...
    local_parts = dbm;/path/to/map.db
    local_part_suffix = +*
    local_part_suffix_optional
    data = ${quote:\
            ${extract{local_part}{$address_data}}$local_part_suffix\
        }@${extract{domain}{$address_data}}


There is more than one way to do it. WARNING: untested, do not assume
this will work.

--
Kirill Miazine
mailto:km@krot.org
http://km.krot.org/