SUMMARY: handling multiple users/domains on a single host with sendmail

From: John Martin (
Date: Wed Jan 17 1996 - 02:07:58 CST

As so many of you pointed out, this was really a sendmail question rather
than a Sun-specific question. (Though I got a fair few "me too" answer).

My original query:
> I have been trying to work out how I can make sendmail route:
> john@x.y.z and
> john@a.b.c
> to different usernames on a single machine where the MX for both domains is
> the same machine. I have tried using the DB extensions in sendmail 8.6.12
> but haven't been able to get anything to work right. (Sure, it is easy to
> get x.y.z and a.b.c to both be "local", the LHS is the problem.)

There is more than one way to do this (explicit rulesets for each user, for
one), but I append what I think describes the solution most succinctly.
This is also available on the web at: (Note that you need to use
sendmail V8 for this.)

Thanks to all who responded and sorry for the delay in summarising.

Date: Fri, 10 Nov 1995 16:25:14 +0100
From: Johan Svensson <>
To: sendmail@sendmail.ORG
Newsgroups: comp.mail.sendmail
Subject: Answer: How do I manage several domains with sendmail?

This is a contribution (if wanted) to the sendmail FAQ.

  * How do I manage several domains with sendmail V8?

        If you want to provide mailservice to several domains and be
        able to add identical names across different domains (example:
           user@a.dom.ain mb1@dom.ain
           user@b.dom.ain mb2@dom.ain
        you may accomplish this by using an external database in
        conjunction with minor Ruleset rewriting in Many
        ISPs (Internet Service Providers) has asked me and here's a
        general solution (you may combine it with userdb's if you
        need to).

        Here it goes:
        1. Make a textfile (I usually make one for each domain and
           concatenate them before database-compilation) with the
           following structure:

           user@a.dom.ain mb1@dom.ain
           user@b.dom.ain mb2@dom.ain

           The LHS (Left Hand Side) is the mail-adress of a particular
           user and the RHS is the corresponding mailbox. An example from
           the that might apply to the real world:


           Note that you have to spell out the complete email-address
           in the LHS entry. The RHS entry may be either a local address
           (for example 'johan' if that account exists) or a complete
           email-adress on another system (or a domain that the server
           recognizes as local for that matter).

        2. Compile the textfile into a database:

              makemap hash mbt.db <mbt

           You may you use other lookup-methods than hash (btree for
           example). The resulting database is mbt.db in this example
           and the input is the textfile mbt.

        3. Add a few lines in
           A. In the beginning (typically in the "local info" section or
              together with the user database option in the "options"

              # Declare mbt as a hash-lookup database:
              Kmbt hash /etc/mail/mbt.db

           B. In the Ruleset 98 section (local part of ruleset 0):

              # Use mailboxtable-database:
              R$+ < @ $+ . > $: $1 < @ $2 > .
              R$+ < @ $+ > $* $: $(mbt $1@$2 $: $1 < @ $2 > $3 $)
              R$+ < @ $+ > $* $: $(mbt $2 $: $1 < @ $2 > $3 $)
              R$+ < @ $+ > . $: $1 < @ $2 . >

        4. Restart sendmail:
           You must do this in order to reread the cf-file.

        5. Up and going!

        6. Test with sendmail -bv or sendmail -bt


Johan Svensson Email:
                   Tel: +46-46-320425
                   Fax: +46-46-188445
Josnet Internetworking AB
Skarpskyttev. 7, 226 42 Lund, SWEDEN
URL: Josnet Home Page


This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:51 CDT