[Exim] Router to archive mail with virtual domains

Etusivu
Poista viesti
Vastaa
Lähettäjä: Iain Donaldson
Päiväys:  
Vastaanottaja: exim-users
Aihe: [Exim] Router to archive mail with virtual domains
Folks:

I've been trying to figure out how to archive incoming and outgoing
mail for a number of virtual domains I have - each sending mail to a
separate archive account.

I've got it working with one domain fine, including adding headers to
differentiate sent and received mail. The router config I have is as
follows (based on an amalgamation of a few examples on the exim-users
list):

archive_outgoing:
     driver =  redirect
     senders = <domain-name>
     data = <domain-archive-email-account>
     unseen
     headers_add = "X-archive-sent: yes"
     redirect_router = localuser


archive_incoming:
     driver = redirect
     domains = <domain-name>
     data = <domain-archive-email-account>
     unseen
     headers_add = "X-archive-received: yes"
     redirect_router = localuser


Whilst this works fine for one domain, what I'd now like to do is have
a file on my system that has lines with the format:

<domain-name1>:<domain-archive-email-account1>
<domain-name2>:<domain-archive-email-account2>
etc...

so that I can archive domains as and when I choose without writing a
router for every domain.

I've tried to set this up for the archive_incoming router replacing the
data and domains lines as follows:

    domains = lsearch:/usr/exim/mail_archive_domains
    # the above line is supposed to expand to a list of domains so we
match as appropriate
    data = ${lookup{$domain}lsearch{/usr/exim/mail_archive_domains}}
    # the above should fetch the archive email account for the specific
domain


But this doesn't seem to work. I understand when I get it to work I'll
have to do something different for the outgoing archive (e.g. use
$sender_address_domain rather than $domain), but am not sure what's
going wrong here.

I've done an extensive search of the list archives and the
documentation, but I think I'm missing something about how the
expansion of lsearch works - my guess is that since each line of the
file has two items the simple lsearch in the domains line doesn't
expand as expected. I'm also suspicious that this approach will match
all domains on the list, but just can't seem to get my head
sufficiently clear on the process.

Anyone care to give me some guidance here ?

Thanks

..Iain

--
Iain Donaldson
iain@???