[ t h e f r a g g l e . c o m ]

technology, photography and anything else that springs to mind.

cheap portable hard disks a go go »« the number of servers you run …

Virtual domains in exim4

I’ve been using exim for a while with virtual domain support, and thought it be best to document what I did somewhere.

For a long time I wondered how I might actually support virtual domains in exim 4 and held off by just dumping all mail from all domains into my mailbox (how gosh darn lazy is that).

I finally got bothered enough to, and found a lot of easy to follow help on the internets (google), and came up with the following additions to my exim4.conf :


domainlist localdomains = dsearch;/etc/exim4/virtual : @ : localhost

and in the routers section

begin routers
...
vdom_aliases:
driver = redirect
allow_defer
allow_fail
domains = dsearch;/etc/exim4/virtual
data = ${expand:${lookup{$local_part}lsearch*@{/etc/exim4/virtual/$domain}}}
retry_use_local_part
pipe_transport = address_pipe
file_transport = address_file
no_more

As you can see there is a directory called /etc/exim4/virtual, which contains several files, each of which define the aliases for a domain, an example file in that directory could look like:
filename: thefraggle.com


* : :fail:
chris : chris@localhost

As you can see this looks pretty simalar to the sendmail aliases file, but requires no rebuilding (if you have used sendmail at some point, you’ll know that you need to issue a “newaliases” command.

Anyway, hopefully that wasn’t too painful, any improvements, suggestions and other observations welcome!

Tags: , , ,
, , ,
June 14, 2007 at 6:59 pm
1 comment »
  • June 14, 2007 at 8:49 pmMatt

    You’ve just confirmed yet again the reason I don’t use Exim. The configuration just looks like gibberish. It’s not as bad as Sendmail but it’s just not user-friendly for me. I know Exim people will say how flexible it is and how you can do tons of stuff with regexps and stuff but for the average mail server it’s overkill in my opinion.

    For example on Postfix I have this config to do the exact same thing as you have just done:

    virtual_alias_maps = hash:/usr/local/etc/postfix/virtual
    virtual_alias_domains = hash:/usr/local/etc/postfix/virtual

    And in that file I have:

    example.com domain
    matt@example.com matt@localhost
    root@example.com root@localhost
    monkey@example.com blah@another.host.com

    anotherdomain.com domain
    blah@anotherdomain.com blah@localhost

    Etc etc.

    Much more user-friendly if you ask me.

Leave a Reply or trackback