README for WebMail v0.7.0

I. Contents

  1. Contents
  2. What is WebMail
  3. Installation
  4. Configuration
  5. User Authentication
  6. Usage
  7. Different Languages, Translating WebMail
  8. Notes
  9. SSL Support (standalone installation)
  10. JDK Installation And Other Java Issues
  11. License
  12. Credits
Top of section "Contents"

II. What is WebMail

WebMail is a server application that allows ISPs to provide a WWW interface for each user to his mailbox(es) (similar to the programs YahooMail or HotMail use). WebMail should scale well enough to support large userbases and should be easy enough to be used in a home LAN.

Features include:

Who should use WebMail:
WebMail's primary goal is to provide ISPs, companies and universities with a simple and zero-cost solution to give WWW mailaccess to their users.
Users can read and write their email while they are sitting in an Internet-Cafe, at expositions, etc without having to carry their PC around.
It is not intended as a replacement for the different personal email clients, but as a supplement for an existing mail solution.
The secondary goal is to unify a user's different email accounts under one interface which is easily accomplished using WebMails folder capability.

Top of section "What is WebMail"

III. Installation

1. Introduction

There are two different ways to install WebMail, the standalone installation and the Java Servlet installation. Which one you should choose depends on what you plan to do with WebMail:

There are also several ways to store data:

Top of section "Introduction"

2. Standalone Server

1. Requirements

To run WebMail properly on your server, you need to have the following software installed:

WebMail has been successfully tested on:

WebMail will make profit of multiprocessor machines (e.g. Sun Enterprise 450) as it is multithreaded in large parts.

Top of section "Requirements"

2. Binary Installation

  1. Change to the prefix where you want to install WebMail (e.g. /usr/local)
  2. Unpack the tar.gz or zip archive: tar xzvf webmail-0.7.0.tar.gz
  3. Change to webmail/bin
  4. Edit the file webmail.sh if necessary
  5. Start WebMail using the provided script ./webmail.sh >> stdout.log 2>&1 &
  6. See Configuration for further steps to take.

Top of section "Binary Installation"

3. Source Installation

Note:Source installation will definately only work on Unix systems!
Note:Source installation is only really useful for developers since you don't need to (and cannot) adapt the program to your specific system settings in Java and I already compile with optimization turned on.

Additional requirements:

To install the source distribution of WebMail you will have to take the following steps:

  1. Change to the src/ subdirectory
  2. Set the CLASSPATH environment variable to your classes.zip (JDK 1.1) or rt.jar (JDK 1.2) archives (on Solaris: /usr/java1.1/lib/classes.zip for JDK 1.1 and /usr/java1.2/jre/lib/rt.jar for JDK 1.2)
  3. Have a look at the makefile and edit it if necessary
  4. Call "make" to compile the classfiles and create the archives (containing classfiles, language dependent HTML templates and images).
    You will find the compiled archives in the lib/ directory when the compilation was successful.
  5. See steps 3 to 5 from binary installation then

Top of section "Source Installation" Top of section "Standalone Server"

3. Servlet Installation

Running WebMail as a Servlet has several advantages over the standalone installation (and also some disadvantages):

Before trying this, please ensure that you are familiar with your Webserver's Servlet configuration. I provided a sample zone file for Apache, though (but you will have to do many modifications concerning the initArgs at the end of the file).

To make use of this feature you have to:

  1. Configure your webserver to run Java Servlets
  2. Add the net.wastl.webmail.servlet.WebMailServlet servlet to your servlet repository (and add all the jar files provided here to the classpath)
  3. Add the necessary initArgs to the servlet configuration for WebMail. These are:
    webmail.plugin.path Path to the plugin directory
    webmail.auth.path Path to the authenticator directory
    webmail.data.path Path were data will be stored (this has to be writeable by the process owner of the webserver)
    webmail.lib.path Path to WebMail libraries
    webmail.template.path Path to language dependent template files
    webmail.storage Set this to net.wastl.webmail.storage.simple.SimpleStorage for the simple storage and to net.wastl.webmail.storage.mysql.MySQLStorage for the MySQL based storage
  4. Ensure that all webmail directories are readable for the WWW-user and that the data directory is writeable by the WWW user.

To simplify the above, I provided an Apache JServ zone file called webmail-servlet.properties in the root directory. You will just have to i modify this file to fit your configuration (mainly the initArgs at the bottom of the file), add a new zone to your Apache configuration and then call webmail with http://www.yourdomain.top/[mountpoint]/webmail

Please note that I haven't tested this with a different server than Apache and that it is still experimental.

Top of section "Servlet Installation"

4. Storage Methods

By default, WebMail uses a so-called SimpleStorage to store user and system configurations, i.e. the data is stored in separate (XML-) files. This is a very easy but not very efficient method.

A more performant method is WebMail's MySQL storage where the data is stored in a MySQL database instead. This has all the advantages of a standardized database management system plus a smaller memory footprint (per session) since data doesn't need to be cached.

1. Why and when use WebMail with MySQL

Using MySQL to store the WebMail data has several advantages, e.g.:

Clearly, this also has some disadvantages:

When you should consider using MySQL:

Top of section "Why and when use WebMail with MySQL"

2. Preparing MySQL

This document assumes that you already have a running MySQL server. If you don't, please set up MySQL and consult the documents provided with it.

  1. Set up a user/password for webmail that has access from the host WebMail will be running on (don't forget to FLUSH PRIVILEGES after that). Give it all privileges (i.e. set everything to 'Y'=). You may change that to access only the "webmail"-database after the database is set up.
  2. In the WebMail contrib directory, have a look at the file mysql_scheme.sql. This file contains the DDL statements for creating a database called "webmail" and creating the necessary tables and relations. You might want to change the database name to something different than "webmail"
  3. Execute mysql -u [webmailuser] -p < mysql_scheme.sql. Please substitute [webmailuser] with the user you configured in step 1. This will first ask you for the password that you gave the webmail user in step 1 and then execute the DDL statements.

MySQL is now set up to work with WebMail.

Top of section "Preparing MySQL"

3. Setting up WebMail for use with MySQL

Setting up WebMail is quite simple. All changes will be done in the startup script webmail.sh (or webmail.bat under Windows or initArgs in case of a servlet installation) in the bin/ directory. The corresponding servlet configuration options are given in "(" and ")".

  1. Change the value of the STORAGE variable (or webmail.storage initArg) to net.wastl.webmail.storage.mysql.MySQLStorage
  2. Change the variables SQL_LOGIN and SQL_PASS (or webmail.storage.sqllogin and webmail.storage.sqlpass initArgs) to the values you configured in section 4, step 1
  3. Change the SQL_HOST variable (or the webmail.storage.sqlhost initArg) to the DNS name of the MySQL server (most likely localhost is just fine if you only have a single server)
  4. Possibly change the value of SQL_DB (or webmail.storage.sqldb) to another database name (whatever you configured in section 4, step 2)

Now you should be able to start WebMail standalone with "./webmail.sh".

Top of section "Setting up WebMail for use with MySQL"

4. Further suggestions

If you are also running Apache with PHP3 on the same (or a different) host:

Also, you can write your own set of administration tools in Perl (or other languages).

Top of section "Further suggestions"

5. WebMail SQL Scheme

The WebMail SQL scheme is not yet well documented, but not too difficult to understand. It consists of the relations "users2userdata" and "users2mailhosts" that connect the data tables as well as the data tables "users", "userdata" and "mailhosts" containing the real data.

Top of section "WebMail SQL Scheme" Top of section "Storage Methods"
Top of section "Installation"

IV. Configuration

WebMail has an administration interface which allows you to perform several runtime administration tasks, including:

1. WebMail Administrator Plugin

1. Connecting

You can connect to the administration interface with your browser by simply entering the URL http(s)://webmail_server:port/admin in the address field of your browser. (set http/https and replace webmail_server and port with the correct values; port is usually port 6789 after the first start on a standalone server; on a servlet installation you will very likely have to add the WebMail mountpoint before the /admin).

You'll be presented the administrator's login screen then. Enter the password there (on first startup the password is "Secret") and click the login button. You should see the system settings form then.

Top of section "Connecting"

2. System Settings

The first page gives you a list of WebMail system variables and their values. You can change any variables you like (there is a short description for each of them) and then hit the submit button on the bottom of the page.

There are basically 4 kinds of input fields (although you will probably only recognize 2 on first look):

All of these fields will check whether the value entered is (more or less) correct if you submit the form.

Note:Special note on password fields: The password is shown encrypted (Unix crypt()), but if you want to change your password, please enter it in plain text. It will then show up encrypted again, after you hit the submit button (but still be the password you just entered).

To shutdown or restart the WebMail server, enter the time in seconds until the action will be performed and hit the appropriate button ("SHUTDOWN" or "REBOOT"). ATTENTION: You will not get anything like an answer after you do this (since you are shutting down the server this is quite difficult) and you will not be asked whether you really want to do this! Most likely you will get a "connection timed out" or "document contains no data" dialog.

Top of section "System Settings"

3. WebMail Virtual Domain Support

Virtual Domains in WebMail are a quite new concept (thanks to Oswaldo E. Aguirre M. for the idea).

They basically provide the following features:

Naturally, with this concept you will need to have at least one domain even if you don't plan to use virtual domains really.

The WebMail virtual domain setup form is quite simple and self explanatory, I think. There is one column where you have to enter the domain name, one where you have to enter this domain's default host (user's primary folder host), one for the authenti- cation host (not necessarily the same as the default host), and some fields that control the restrictions for users of this domain. With the checkbox, you can turn on/off host restriction completely, in the allowed hosts column, you can enter a comma-separated list of domains/hosts where users may access IMAP folders (e.g. "wastl.net" would allow them to use "mail.wastl.net" and "pop.wastl.net" while setting it to "mail.wastl.net" would just allow "mail.wastl.net" (and certainly "imap.mail.watl.net") and so on (suffix is matched to say it simple)).

Top of section "WebMail Virtual Domain Support"

4. Editing Users

You can add, edit and delete users from the administration interface (Note that you don't have to create users before they may use WebMail since they get default settings when they first log on authenticating against IMAP, POP or Unix).

To create a user,

To edit a user,

To delete a user,

Top of section "Editing Users"

5. Viewing WebMail Status

Last but not least you can get an overview of currently active sessions with the "view sessions" link. You will get some status information there as well as the possibility to explicitly kill an active session (whatever maybe the reason). Please be careful however with this feature, as you are very likely to kill a session that is currently in use and its user will probably not be very happy about that. The sessions will expire after a configured time anyway.

The Administrator Interface is currently available in English only, but the templates are already prepared for translation The system's default language will then be used (determined by the LANG environment setting).

I hope the rest is quite self explanatory at the moment, but I'll add some documentation later.

Top of section "Viewing WebMail Status" Top of section "WebMail Administrator Plugin"

2. File-Based Shutdown

You can initiate a WebMail shutdown when you create a file "shutdown" (or whatever you configured) in the data directory with only the admin password in it. This option can be disabled. It is useful in automatic system startup/shutdown.

Top of section "File-Based Shutdown"
Top of section "Configuration"

V. User Authentication

WebMail supports extended user authentication. At the moment, the following authentication methods are supported:

Changing authentication method can be achieved using the Administration Interface and changing the "AUTH" variable. For IMAP authentication there is an extra configuration variable called "AUTHHOST".

Top of section "User Authentication"

VI. Usage

1. General Usage

The WebMail daemon listens on whatever port you have configure. Just point your browser´s URL to http://yourhost:yourport/ and see the login screen.

A user will get the password he logs in with the first time. Passwords may be changed by the user in the options dialog. WebMail will try to establish a default connection to the configured default IMAP host with the user ID and password it was given, so it may be useful to use the same ID and password as on the IMAP host.

For further information, just click on the "?" at the navigation bar.

WebMail should also work with Proxy Servers and other Clients than Netscape Communicator.

Top of section "General Usage"

2. Folders

Note:This section is deprecated and will be updated soon
WebMail supports as many IMAP folders on as many different hosts you like. However, the WebMail administrator can configure a "default path" to prepend to all pathnames entered by the user to ease usage. (just typing "webmail" as a folder is MUCH easier than typing /mnt/users6/inst/schaffer/mail/webmail). The default path is now set to "/home/%user%/mail" (%user% being replaced with the username of theIMAP server - the one the user enters in the login field for the IMAP server), but can be changed by the administrator to almost anything (e.g. "/var/mail/%user%/ for mail-only servers).
Note, that putting a "/" before the foldername still allows to specify absolute pathnames.

Top of section "Folders"
Top of section "Usage"

VII. Different Languages, Translating WebMail

WebMail supports the usage of different languages on a per user basis. Since v0.6.0 WebMail scans for available languages automatically and adds the corresponding locales to the user's setup dialog ("de" will add the locales "de_DE", "de_AT", "de_CH", ...).
To translate WebMail to a new language, please read the file "Translating" in the developers' documentation (source only).

Top of section "Different Languages, Translating WebMail"

VIII. Notes

1. WebMail Status

WebMail v0.7 is considered BETA, as not all features I want for a "1.0" are yet included.

Things I think of are:

Top of section "WebMail Status"

2. Changes

See the file "Changes" for a list of changes in the different WebMail releases.

Top of section "Changes"
Top of section "Notes"

IX. SSL Support (standalone installation)

Since WebMail 0.7.0, there is finally a free SSL implementation available for Java called ITI-SSL.

Installation is simple:

However, SSL in WebMail has some drawbacks:

If you compile ITI-SSL yourself, please ensure that you use openssl-0.9.4 for compilation because Netscape and IE won't work with WebMail SSL with prior versions.

Top of section "SSL Support (standalone installation)"

X. JDK Installation And Other Java Issues

1. What is Java

Note:I'll make it short here as Java is pretty well known and documented.

Java is a platform independent, object-oriented (OO) programming language. Java programs are compiled using the JDK Compiler (javac) or other compilers (e.g. IBM jikes). The resulting bytecode is optimized for the Java Virtual Machine (JVM) and still platform independent.
The JVM interpretes the previously compiled bytecode and translates it "on the fly" into platform dependent system calls. Therefore a JVM must exist for your platform in order to run Java programs.
You'll obviously recognize that Java is an interpreted language similar to Perl or Python. The most sigificant difference to the former two is that Java is precompiled.
So Java is a kind of compromise between purely interpreted languages and languages that are compiled to machine code which tries to combine the advantages of both (reliability and speed). As far as i know, this principle is derived from PROLOG.

Top of section "What is Java"

2. Where to obtain Java for your platform

The main Java distribution site is http://java.sun.com.
You will get the "officially supported" platforms and lots of documentation and additions there.

Java distributions for the different platforms:
Solaris SPARC and x86http://java.sun.com
Windows:http://java.sun.com
Linux/x86:http://www.ibm.com (recommended IBM JDK 1.1.8)
http://www.blackdown.org (Blackdown port of JDK 1.2)
http://java.sun.com (Sun and Inprise port of JDK 1.2)
Linux/PPC:http://business.tyler.wm.edu/mklinux/
Linux/Alpha:http://www.voicenet.com/~gatgul/JDK/java-alpha.html
Linux/SPARC:http://tinukai.sesuadra.org/~jdk/
AIX:http://www.ibm.com
Macintosh:http://applejava.apple.com
OS/2:http://www.ibm.com
FreeBSD:http://www.freebsd.org/ports/lang.html

Top of section "Where to obtain Java for your platform"

3. How to install Java properly

Use your system's standard facility to install the Java packages. Note that the Linux JDK most likely comes as "tar.gz" and not as .rpm or .deb, so you will have to manually install it using tar.

On Solaris, the JDK will install in /usr/java1.x/ by default. On Linux, I prefer installing the "tar.gz" in /usr/local and renaming the extracted path to "java1.x". Many distributions, however, will install Java in /usr/lib/java1.x or /usr/lib/jdkxxx.

Next, link all programs in the bin/ directory to somewhere in your path (e.g. /usr/local/bin) or alternativly add the bin/ directory to your PATH environment.

Last, set your CLASSPATH environment variable (e.g. in /etc/profile) to

You should have a running system now. Test it by typing "java -version".

Special note for Linux users: There are problems with earlier versions of the libc6 (aka glibc). Please use glibc 2.1.2 or above to ensure a stable environment for WebMail.

Top of section "How to install Java properly"

4. Improving speed

To improve Java performance, you will most likely use an JIT (Just in time compiler) that compiles bytecode to native code on-the-fly (while executing the program). This especially improves speed for routines that are used frequently, as it is with WebMail. So I strongly recommend using a JIT for WebMail!

If you already have Java 1.2 (aka Java 2) or the IBM JDK 1.1.8 on Linux, you won't need to get a JIT as it already ships with one. If you still have Java 1.1, it depends on your platform.

I don't know what it's like for other platforms. You can always try whether you have a JIT or not by setting JAVA_COMPILER to "NONE" and testing whether that affects the execution speed of WebMail. If it is considerably slower, than you most likely already have a JIT.

Top of section "Improving speed"

5. Glossary

JDKJava Depelopment Kit - what you need to compile programs
JREJava Runtime Environment - what you need to only run programs
JVMJava Virtual Machine - bytecode interpreter
JITJust In Time Compiler - improves execution speed of the JVM

Top of section "Glossary"
Top of section "JDK Installation And Other Java Issues"

XI. License

WebMail is (c)1998-2000 by Sebastian Schaffert, schaffer@informatik.uni-muenchen.de

WebMail is distributed under the terms of the GNU Lesser General Public License (LGPL). You can find a copy in the file COPYING.

The LGPL allows you, said in short, to add WebMail to other projects that are not covered by the GPL.

Top of section "License"

XII. Credits

I give my credits to all who reported me bugs and made suggestions to improve WebMail.

Some, however, I want to mention explicitly:

Sebastian Schaffert, schaffer@informatik.uni-muenchen.de

Top of section "Credits"