Re: [exim] Redirection on multiple conditions

Pàgina inicial
Delete this message
Reply to this message
Autor: Tony Finch
Data:  
A: Miham KEREKES
CC: exim-users
Assumpte: Re: [exim] Redirection on multiple conditions
On Sun, 9 Jan 2005, Miham KEREKES wrote:

> if /etc/exim4/virt/$domain.aliases exists, I have to lsearch in that file,
> and if the $local_part not exists in $domain.aliases, I have to lsearch
> in the /etc/exim4/virt/DEFAULT_ALIASES file. If no result, the
> $local_part is "nonexist".
> And, in addition, I have to handle webmaster different way, which means
> if the $local_part is webmaster, then I have to do an lsearch in the
> /etc/exim4/virt/webmaster_aliases file for $local_part@$domain, and if I
> can't find it, the target mailbox should be webmaster_default, otherwise
> the found value.


Use three routers, one for each case. The redirect router declines if the
lookup fails in aliases_general, so it falls through to aliases_default.

aliases_webmaster:
  driver = redirect
  local_parts = webmaster
  data = ${lookup{$local_part}lsearch{/etc/exim4/virt/webmaster_aliases}
           {$value} {webmaster_default} }
  debug_print = "R: webmaster alias for $local_part@$domain"


aliases_general:
driver = redirect
data = ${lookup{$local_part}lsearch{/etc/exim4/virt/$domain.aliases}}
debug_print = "R: general aliase for $local_part@$domain"

aliases_default:
  driver = redirect
  data = ${lookup{$local_part}lsearch{/etc/exim4/virt/DEFAULT_ALIASES}
           {$value} {nonexist} }
  debug_print = "R: default aliase for $local_part@$domain"


Tony.
--
<fanf@???> <dot@???> http://dotat.at/ ${sg{\N${sg{\
N\}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}\
\N}{([^N]*)(.)(.)(.*)}{\$1\$3\$2\$1\$3\n\$2\$3\$4\$3\n\$3\$2\$4}}