Adding a New Domain
to QMail for Virtual Hosting
at Loblolly.net

A general guide/checklist to qmail setup on Loblolly.net

(This guide assumes knowledge of using vi, the unix editor.)

Need to have down three things first before adding newdomainname.??? to Qmail:

1 - Loblolly must be authoritative for that domain...

whois newdomainname.??? (where ??? is either com, net or org)

should give Loblolly.nets dns servers
dns1.loblolly.net 216.61.157.137
dns2.loblolly.net 216.61.157.138

2 - setup the new Virtual Domain in DNS with MX 0 mail.loblolly.net

3 - Have added the user responsible for the new Virtual Domains mail.

Note: to recieve email for that domain does not require the domain to be setup
for web/URL in Apache.

Now that those three things have been done ...Onward to Little Bighorn!

Login to Loblolly.net and gain root.

$ su

then change to qmails conntrol directory

# cd /var/qmail/control

Now lets tell QMail to recieve mail for the new domain by adding it
to the rcpthosts file.

# vi rcpthosts

and add newdomainname.??? to the bottom of the list..
Then save the file... (shift zz)

Now to tell QMail what user is responsible for the mail for newdomainname.???
This is in the file virtualdomains. (See the QMail FAQ)

# vi virtualdomains

Note that the format is virtualdomain:username-handlename. The handle-name does not have
to be the same as the name of the virtualdomain, but it's easier to understand.

Two or more virtualdomains can use the same username-handlename...
For example: mack.org:bob-mackmail and mack.com:bob-mackmail

Once you are done adding the virtualdomain:username-handlename the save the file (shift zz).

Now that's done QMail will read these changes the next time QMail-send starts..
So either shutdown and restart Loblolly.net NOT!!! or better yet HUP qmail-send..

# ps -aux | grep qmail-send

get the pid-number in the second column and..

# kill -HUP pid-number

This will kill it and restart qmail-send using the new virtualdomain.
(Hope to have a one liner to restart qmail-send very soon...)

Now to add the handlename to the users directory, Bob's directory in this case.

# cd ~bob

# pwd (to make sure you are in Bob's directory)

# vi .qmail-handlename-default ( for a general catch all )

You can put in one or more email addresses in this file. Each address on one line.

# vi .qmail-handlename-bob (for mail sent to bob@virtualdomain.???)

You can put in one or more email addresses in this file. Each address on one line.

# vi .qmail-handlename-info (for mail sent to info@virtualdomain.???)

You can put in one or more email addresses in this file. Each address on one line.

Be sure to change ownership of these files to bob, otherwise, he will not be able to change
his own files and the aliasing will not work.

# chgown bob.users .qmail*

Bob can now add more alising by adding more files in the same manner as above or
editing the existing .qmail-handlename-alias. Don't forget the dot at the first of the name!!

Note: these dot files will not show up in a ls -l listing or a web page listing/index..
Use ls -la to see them or ls -l .qmail*

This capability of QMail to allow the user to edit/add their own aliasing is great!!!

That's all folks!!!

Last edited on May 28, 1999
mailto:hostmaster@loblolly.net