Webmail Configuration with Squirrelmail in Debian
What is SquirrelMail?
Requirements for running SquirrelMail
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.
Installing SquirrelMail in Debain
#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.
Configuring Squirrelmail in Debian
This will start 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.
Organisation Preferences, enables you to brand SquirrelMail with your own system name and logo
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.
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.
Apache Configuration For webmail
If you want to check apache installation click here
If you want to check apache virtual hosts configuration click here
Edit the /etc/apache2/sites-available/configfile.conf (this file name may vary from person to person) Apache configuration file and add the following block:
Here's a breakdown of what's above:
<VirtualHost 126.96.36.199:80> - This indicates I'm setting up my mail interface as a virtual host, rather than IP based. Obviously, you're going to want to replace 188.8.131.52 with the IP address of your web server. Additionally, what you have here may vary from server to server and is dependent on how you have your Apache configured. Be cautious!
ServerName mail.yourdomain.com - The official name of the webmail server virtual host.
ServerAlias mail.* - This line establishes a wildcard serveralias called mail.*. With this setup, any domain that is pointed to your server and that has an A record called "mail", will be able to get to the webmail interface by simply going to http://mail.whateverdomain.com. This is a pretty cool little feature and makes accessing the webmail interface easy for all of your users.
ServerAdmin [email protected] - The server administrative contact. This is not required, but I like to include it.
DocumentRoot /home/www/webmail - The document root of your webmail interface. This will vary, depending on where you chose to install Squirrelmai. In this example, you can see that I installed it at /home/www/webmail
</VirtualHost> - The closing tag to the virtualhost.
Make sure you restart Apache after making the above changes.
Now go to https://webmail.test.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.test.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.
More Webmail Software