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

トップ ページ
このメッセージを削除
このメッセージに返信
著者: Kirill Miazine
日付:  
To: Noah Meyerhans
CC: exim-users
題目: Re: [Exim] rewriting, redirecting, and the sendmail "+ hack"
Noah Meyerhans wrote:
> --
> [ I already tried posting this, but from an unsubscribed address.
> Hopefuly the moderator will notice this repost and cancel the other
> message. I apologize if it gets posted twice ]
>
> Hi folks. I've got a site using sendmail, and I'm trying to duplicate
> some weird rewriting and redirecting that it does in Exim 4.20.
>
> Basically, the mail server in question is nothing but a relay. There
> are no local mailboxes. Mail addressed too user@domain is redirected
> based on a 1-to-1 mapping in a dbm file, basically just like
> /etc/mail/aliases, with one exception: We pass the sendmail "+ hack"
> through to the recipient of the redirected message.
>
> So, assume the aliases file contains
> foo: foo@???
>
> mail to foo@domain will be redirected to foo@???, including
> envelope recipient rewriting. The hard part is that foo+bar@domain will
> be redirected to foo+bar@???, and the envelope recipient will
> be rewritten to foo+bar@???. That's for any value of bar; we
> don't know it in advance.
>
> The sendmail.cf to make this work is evil, but it does work. I think
> Exim can accomplish what I need, and probably be less evil that
> sendmail, but I'm fairly inexperienced with Exim's rewriting
> capabilities.
>
> I can do it (I think... exim -brw indicates that it's doing the right
> thing) using two dbm lookups, if I store the local-part and the domain
> of the recipient in separate dbm files, like this:
> N^([^!]+)\+(.*)@domain$\N   "${lookup{$1}dbm{/usr/local/exim/etc/csail.names.db} {$value}fail}+$2@${lookup{$1}dbm{/usr/local/exim/etc/csail.domains.db}{$value}fail}"    T

>
> But I'd certainly like to be able to do it in a single dbm lookup.
>
> Any help would be greatly appreciated! Thanks!
> noah


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>


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