On 2008-03-26 at 14:24 -0400, Jason Keltz wrote:
> Let's say that I have users local mail stored in one of two locations --
> /var/mail or /local/mail. When mail is delivered, I can't just specify
> the default "file=/var/mail/$local_part" under "local_delivery". How
> might I look up which file to deliver to from a file ordered something
> like this:
>
> user1 /var/mail/user1
> user2 /local/mail/user2
If your configuration is anything like the default, then you should have
a "local_delivery" transport which looks like:
local_delivery:
driver = appendfile
file = /var/mail/$local_part
delivery_date_add
envelope_to_add
return_path_add
group = exim
user = $local_part
mode = 0660
no_mode_fail_narrower
This is the mechanism invoked by the "localuser" Router for
"transport"ing the mail to its destination.
Change the "file = ..." line to be constructed differently:
file = ${lookup {$local_part}lsearch{/my/special/file}}
That assumes that every user is always listed. If some users aren't
listed and you want those users to default to /local/mail/ then:
file = ${lookup {$local_part}lsearch{/my/special/file}{$value}{/local/mail/$local_part}}
Exim comes with a file "spec.txt" which the full doc; it's also
browsable online at
www.exim.org; see:
9.3 Single-key lookup types
and other areas around here for more information on the types of
lookup that can be done and how to allow forms of wildcarding, etc.
11.5 Expansion items
${lookup{<key>} <search type> {<file>} {<string1>} {<string2>}}
-Phil