[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mails for other domains



On Sat, Jul 13, 2002 at 09:47:12PM +0100, Fisayo Adeleke wrote:
> I have currently have exim running for a single domain 'mycompany.com' and
> it's sending and receiving mails perfectly. How can i set up my exim to
> hold mails for more than one domain e.g. customer1.com, customer2.net and
> thatcompany.org, etc.?

One way of doing this is given here:
http://www.ws.afnog.org/afnog2002/track1/exim/EximPrac.pdf
(in section 2.1). This lets you set up a separate aliases file for each
virtual domain, e.g.

    # Aliases file for customer1.com
    sales:    mailbox123
    info:     mailbox124

Another way was posted to this list a little while ago [attached], to route
mail for allusers at somedomain to a single local mailbox, e.g.

    customer1.com:          mailbox123

Another way is to use an external database (e.g. mysql or LDAP) which
contains the mapping of E-mail address to mailbox file or maildir. If you
build your mailserver this way, and also have a POP3 server which
authenticates against your mysql/LDAP database, then you can set it up so
that you do not need each of your users to have an entry in the Unix
password file at all.

Regards,

Brian.


On Mon, Jun 03, 2002 at 06:25:45PM +0000, Godfred Ofori-Som wrote:
> I am trying to setup a virtual domain with exim. I have looked at the 
> configuration but i think what i want is different from the way virtual 
> domains has been described.
> The configuration I want, is to use exim to collect emails for some domains 
> and just drop it to a single mailbox on my mail server.

The same question was raised by someone at the workshop. One solution is to
modify the router slightly: change 'lsearch' to 'lsearch*'

virtual_domains:
  driver = redirect
  domains = lsearch;/usr/exim/vdomains
  data = ${lookup{$local_part}lsearch*{/usr/exim/aliases-$domain}}
                              ^^^^^^^^
  no_more

Then you can put entries in /usr/exim/aliases-example.com of the form:

    sales:   mailbox123
    *:       mailbox456

in which case mail to 'sales at example.com' will get delivered to
'mailbox123', but mail to '<anythingelse> at example.com' will get delivered to
'mailbox456'

(changing 'lsearch' to 'lsearch*' means that if exim fails to find the value
it was looking up, it tries the lookup again for the value '*')

That gives you a lot of flexibility, but it still requires you to create a
separate file for each domain, which may have only one entry in it.

It's very easy to change the router so it just looks up the domain in a
single file:

virtual_domains:
  driver = redirect
  domains = lsearch;/usr/exim/vdomains
  data = ${lookup{$domain}lsearch{/usr/exim/vdomains}}
  no_more

In this case you have only one file, /usr/exim/vdomains, with entries like
this:

example.com:	mailbox123
example.net:	mailbox456

Mail to <anylocalpart> at example.com will be delivered to mailbox123, and mail
to <anylocalpart> at example.net will be delivered to mailbox456.

Notice the difference in the lookup expression:

  ${lookup{ VALUE-TO-LOOKUP } SEARCHTYPE { FILE }}

In the first case we told exim to lookup the local-part (left-hand side of
the address) in a file, whose name depended on the domain (right-hand side
of the address)

In the second case we tell exim to lookup just the domain in a single file.

Is that what you were looking for?

Regards,

Brian.

-----
This is the afnog mailing list, managed by Majordomo 1.94.5

To send a message to this list, e-mail afnog at afnog.org
To send a request to majordomo, e-mail majordomo at afnog.org and put
your request in the body of the message (i.e use "help" for help)

This list is maintained by owner-afnog at afnog.org