On Wed, Aug 16, 2000 at 07:23:15AM -0400, Alec Smith wrote > Using Exim, how can I configure it to process mail for multiple domains? > Specifically I want mail to domaina.com processed by the .procmailrc in > User A's home directory while mail to domainb.com is processed by the > .procmailrc in User B's home directory. Exim is already configured to > accept mail for the domains, but doesn't do any special processing based on > the domain name. > > At the same time, I'd like to take some mail to [EMAIL PROTECTED] and > deliver it directly to someotheruser on the same machine. Is there a way to > do this without having to use .procmailrc and process the e-mails twice? > (ie [EMAIL PROTECTED] -> someotheruser and someuser2 -> domain.com are > mapped in an Exim database -- Something along the lines of Sendmail's > virtusertable file) >
There's more than one way to skin a cat, but here's what I've done; it allows you to have an arbitrary number of virtual domains with each having its own alias file, which allows you to do most things including what you are looking for. Some of my virtual hosts are in .com.au, and some are in .com; I have a file for domains with three parts (e.g., mydomain.com.au) at /etc/exim/domains, and a file for domains with two parts at /etc/exim/domains2. Each file contains lines like this: *.mydomain.com.au myfile *.otherdomain.com.au otherfile for each domain. My setup allows me to match arbitrary subdomains (e.g., mail.outgoing.mydomain.com); if you don't want to match subdomains you can omit the "*." from each line, and use a single file for all domains. The second field is the name of an aliasfile for the domain matched by the first field. To forward all mail for a domain to "myuser's" local mailbox, the specified file need contain only the line: * myuser but it can also use any construct that Exim recognises in alias files (pipes, :blackhole:, etc.). In exim.conf, I set local_domains like this: local_domains = localhost:my.net.au:*.my.net.au:\ partial3-lsearch;/etc/exim/clients/domains:\ partial2-lsearch;/etc/exim/clients/domains2 The linebreaks and whitespace are there only for legibility in this post, and "my.net.au" is not the real domain; my apologies to whomever owns that name. The "partial*-lsearch;" allows me to match arbitrary subdomains (e.g., mail.outgoing.mydomain.com.au). If you don't want to match subdomains you can put all virtual domains into one file and use just "lsearch;" I have two directors that handle virtual domains: virtual: driver = aliasfile except_domains = localhost:my.net.au:*.my.net.au domains = partial3-lsearch;/etc/exim/clients/domains no_more file = /etc/exim/clients/$domain_data search_type = lsearch* virtual2: driver = aliasfile except_domains = localhost:my.net.au:*.my.net.au domains = partial2-lsearch;/etc/exim/clients/domains2 no_more file = /etc/exim/clients/$domain_data search_type = lsearch* Again, if you don't want to match arbitrary subdomains (or all of your virtual domains are the same length) you need only one of these. You can put these directors at the head of your directors section, but I'm not clear on how expensive this is as it appears to involve a file lookup for "normal" local messages (yes, in spite of the "except_domains" line). This isn't a big deal if the bulk of your mail is for the virtual domains; if not you can avoid it by putting these directors at the end of the directors section, but you must then add the line domains = localhost:my.net.au:*.my.net.au to the other directors, so that they are not matched for your virtual domains. John P. -- [EMAIL PROTECTED] [EMAIL PROTECTED] http://www.mdt.net.au/~john Debian Linux admin & support:technical services