Posted by kink on Fri 29 Jul 2005 at 14:50
Ever since hotmail originally introduced the concept of a mailbox accessible over the web (way before Microsoft bought them), webmail has been a popular way of accessing email while on the road. This article describes setting up webmail for the users of your Debian system.
SquirrelMail is probably the most popular open source webmail client. It has a focus on compatibility, so it's usable even with the most archaic browser as long as it supports frames and cookies. Yet, it offers all features of a complete mail client.
For starters you'll need a PHP-enabled webserver, like apache or apache2 with the php4 module.
SquirrelMail runs on top of an IMAP-server. Having an IMAP-server installed and working is a pre-condition and is not really covered in this article.
Examples of good IMAP server packages are courier-imap, cyrus and dovecot. If you don't want to offer your users direct IMAP access, you can block outside access to port 143 except for the machine hosting SquirrelMail.
On to installing SquirrelMail. This is easy:
apt-get install squirrelmail
You'll see that it depends on squirrelmail-locales, the translations package. If you're using etch or sid, the squirrelmail-locales package is only recommended, so you can remove it if you have English speaking users exclusively.
After installation, it's time for configuration, run from the command line:
This will present an interactive menu where all possible aspects of SquirrelMail can be configured. Start with the bottom option, D. Set pre-defined settings for specific IMAP servers. This preloads some settings specifically for your IMAP server package.
Menu 1, Organisation Preferences, enables you to brand SquirrelMail with your own system name and logo. Menu 2, Server Settings is for configuring the backends of your webmail. The option "Domain" is the domain that is appended to your outgoing email. By default this is read from /etc/mailname.
Press A to configure your IMAP server. Changing the options "Authentication Type" and "TLS" will make the connection with your IMAP server more secure. However, this only makes sense when your IMAP server is not on localhost; encrypting traffic over the local interface is wasting processor cycles. The option Server Software should already be set to to your IMAP server package when you loaded the predefined settings. Option B, SMTP settings, should not have to be changed in most cases.
Menu 3 Folder Defaults can safely be left untouched. Under 4, General Options, you can make some tweaks. Be sure to set option 11, allow server-side sorting. This greatly improves SquirrelMail performance and works with nearly all IMAP servers. Feel free to look around the configuration options. I'd advise not to enable any plugins until you've verified that your current setup actually works. Once it does, you can add plugins. If something breaks, you'll know which plugin to blame.
Press S to save and Q to quit. Under /etc/squirrelmail you'll also find some configuration files for plugins and the file default_pref where you can set default preferences for new users.
Now to make the install web-accessible. With the configuration files you'll find an Apache configuration snippet you can edit and add to your Apache config. It's wise to add it to the configuration of Apache-SSL aswell, so your users can access their mailbox over a secure connection. After that, reload Apache. We should be done!
Now go to https://webmail.example.com/src/configtest.php (if you configured SquirrelMail at the webmail.example.com virtual host). If this configuration test doesn't turn up any errors, proceed to https://webmail.example.com. You will be presented with a login screen. Enter your username and password (the same as your system login). If all went fine you should see your mailbox!
If it does not work, check whether your browser has cookies enabled. Also verify whether your IMAP server is working correctly (in its logs, and/or with a regular IMAP mail client). You can also check your webserver logs for any error messages.