Next Previous Contents

7. Routing incoming messages by host

7.1 How do I receive mail for another host name?

I'd like our disk server, pokey.af.mil, to receive mail addressed to af.mil. I've set up an MX from af.mil to pokey.af.mil, but how do I get pokey to treat af.mil as a name for the local host?

Answer:

Add af.mil to /var/qmail/control/locals and to /var/qmail/control/rcpthosts. If qmail-send is running, give it a HUP.

7.2 How do I set up a virtual domain?

I'd like any mail for nowhere.mil, including root@nowhere.mil and postmaster@nowhere.mil and so on, to be delivered to Bob. I've set up the MX already.

Answer:

Put

nowhere.mil:bob

into control/virtualdomains. Add nowhere.mil to control/rcpthosts. If qmail-send is running, give it a HUP.

Now mail for whatever@nowhere.mil will be delivered locally to bob-whatever. Bob can set up ~bob/.qmail-default to catch all the possible addresses, ~bob/.qmail-info to catch info@nowhere.mil, etc.

7.3 How do I set up several virtual domains for one user?

Bob wants another virtual domain, everywhere.org, but he wants to handle nowhere.mil users and everywhere.org users differently. How can we do that without setting up a second account?

Answer:

Put two lines into /var/qmail/control/virtualdomains:

nowhere.mil:bob-nowhere
everywhere.org:bob-everywhere

Add nowhere.mil and everywhere.org to /var/qmail/control/rcpthosts. If qmail-send is running, give it a HUP.

Now Bob can set up separate .qmail-nowhere-* and everywhere-* files. He can even set up .qmail-nowhere-default and .qmail-everywhere-default.

7.4 How do I organize a big network?

I have a lot of machines, and I don't know where to start.

Answer:

  1. Choose the domain name where your users will receive mail. This is normally the shortest domain name you control. If you are in charge of *.movie.edu, you can use addresses like joe@movie.edu.
  2. Choose the machine that will know what to do with different users at movie.edu. Set up a host name in DNS for this machine:
    mailhost.movie.edu IN A 1.2.3.4
    4.3.2.1.in-addr.arpa IN PTR mailhost.movie.edu
    
    Here 1.2.3.4 is the IP address of that machine.
  3. Make a list of machines where mail should end up. For example, if mail for Bob should end up on Bob's workstation, put Bob's workstation onto the list. For each of these machines, set up a host name in DNS:
    bobshost.movie.edu IN A 1.2.3.7
    7.3.2.1.in-addr.arpa IN PTR bobshost.movie.edu
    
  4. Install qmail on bobshost.movie.edu. qmail will automatically configure itself to accept messages for bob@bobshost.movie.edu and deliver them to Bob's mailbox on bobshost. Do the same for the other machines where mail should end up.
  5. Install qmail on mailhost.movie.edu. Put
    movie.edu:alias-movie
    
    into /var/qmail/control/virtualdomains on mailhost. Then forward bob@movie.edu to bob@bobshost.movie.edu, by putting
     
    bob@bobshost.movie.edu
    
    into ~alias/.qmail-movie-bob. Do the same for other users. If you have many users you should set up these aliases with fastforward ( http://pobox.com/~djb/fastforward.html) instead.
  6. Put movie.edu into /var/qmail/control/rcpthosts on mailhost.movie.edu, so that mailhost.movie.edu will accept messages for users at movie.edu.
  7. Set up an MX record in DNS to deliver movie.edu messages to mailhost:
    movie.edu IN MX 10 mailhost.movie.edu
    
  8. On all your machines, put movie.edu into /var/qmail/control/defaulthost.


Next Previous Contents