Readme file for the virtual hosting plugin by Ray Todd Stevens (raytodd@kiva.net)

The purpose of this plugin is to allow the proper default email address when using multiple name
based virtual hosts on apache.   Most of this document will deal with the setup of the virtual
hosts, as the plugin itself is pretty straightforward.  What it does is uses the host name supplied by
apache to calculate what should be the domain name portion of the email address.   

This plugin assumes that email addresses on the system are of the form unix userid@main domain. 
The user id is the one that is used to log into squirrelmail.   This system assumes that the web
page host will be of the form www.example.com or more likely mail.example.com , and that the
email address will then be userid@example.com.  Part of what the plug does is strips the mail and
www prefixes off the domain name.  It also assumes that if the virtual host plugin is active, that
you want to use this virtual host.   It overrides and ignores the Mail Domain setting in
configuration.   The plugin also lists the default mail host name on the top of the left hand pannel. 
This plugin can be active or not active, and basically this is the only configuration available.

The main things that need to be done for this plugin to work is to setup the web server to work
with it.   There are two ways to do thing.  The simplest is to use the name server and setup each
virtual host with a host named mail which points to the same ip address.  The other is to setup a
allias such as mail which routes to squirrelmail.   I have experimented with this second option and
find that the first one works much more reliably.

In either case you will want to setup a user on your system such as squirrel which contains and
controls the squirrel mail files.   The installation guide for squirrelmail convers how to set this up
quite nicely.   Then untar the plugin files into a directory in your plugin directory as covered by
the instructions in the INSTALL file.

Now to use the name server system to set this up first point the name mail.example.com at an IP
address.  In my case I used the ip of the virtual web hosts already on the system.   I happen to use
a single file which is used by all domains which only contain virtual hosts.

cat webstub.zone 
$TTL 86400
; zone file for all web only domains it points at the named entry
@               IN      SOA     (
                        2003010400 ; serial
                        10800 ; refresh
                        3600 ; retry
                        604800 ; expire
                        86400 ; default_ttl
                        )
                IN      NS      ns1.example.com
                IN      NS      ns2.example.com.
                IN      A       1.2.3.4 (your ip address)
$ORIGIN @
www             IN      CNAME   @
mail    IN  CNAME   @

Then setup you httpd.conf file so that the 1.2.3.4 is an ip for named virtual hosts.   (Ie use
namevirtualhost 1.2.3.4)   The take one of the domains and define the mail virtual host for that
domain. (IE: mail.example.com) point the document root at squirrelmail files.  And now browsing
mail.example.com gives you the squirrelmail program.  If you also have the domain sample.com
setup the same way and DO NOT set up mail.sample.com as a virtual domain, then the apache
programming means that browsing mail.sample.com gives you the same web site.

This is where the plugin comes in.  If activated all mail sent while browsing mail.example.com will
come from example.com, and all mail sent while browsing mail.sample.com will come from
sample.com.   Note that this plugin does not attempt to prevent users from logging in as a domain
they are not from.  That users which are from sample.com can in fact longin by pointing their
browser at mail.example.com and send mail from that domain.



