* on the Wed, Feb 21, 2007 at 03:56:39PM +0100, Jan Johansson wrote:

> I am trying to figure out how to make a simple lookup work right.
> Basically, I have a file in the form of
> 
> Username:     yes
> Username2:    yes
> 
> And I want to trigger a router if the user is listed herein. My current
> lookup does not seem to trigger as expected
> 
> domain_redirect:
>         driver = manualroute
>         domains = mydomain.com
>         local_parts =
> ${lookup{$local_part}lsearch{/etc/exim4/domain-redirect}}
>         transport = remote_smtp
>         route_list = * 192.168.0.201
>         host_find_failed = defer
>         same_domain_copy_routing = yes
>         no_more

| [EMAIL PROTECTED]:~/foo$ echo -ne "Username: yes\nUsername2: yes" >
| lookup_file.txt
| [EMAIL PROTECTED]:~/foo$ /usr/sbin/exim4 -be
| > ${lookup{Username}lsearch{lookup_file.txt}}
| yes
| > ${lookup{UsernameFoo}lsearch{lookup_file.txt}}
|
| >

This shows that your lookup method returns either "yes" or "" when
expanded. This means that the only address that would match is
"[EMAIL PROTECTED]" and that would only match if the username "yes" was
in the "domain-redirect" file.

The expansion should return the local part it's self. Try replacing
with:

${if eq{${lookup{$local_part}lsearch{lookup_file.txt}}}{yes}{$local_part}{}}

Mike

-- 
## List details at http://www.exim.org/mailman/listinfo/exim-users 
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://www.exim.org/eximwiki/

Reply via email to