Debianhelp.co.uk

         Webmail Configuration with Squirrelmail in Debian

     What is SquirrelMail?

SquirrelMail is a standards-based webmail package written in PHP4. It includes built-in pure PHP support for the IMAP and SMTP protocols, and all pages render in pure HTML 4.0 (with no JavaScript required) for maximum compatibility across browsers. It has very few requirements and is very easy to configure and install. SquirrelMail has all the functionality you would want from an email client, including strong MIME support, address books, and folder manipulation.    

     Requirements for running SquirrelMail

  • UNIX/Linux or Windows (UNIX/Linux version may be more functional)
  • You need at least PHP 4.1.2. If you are using PHP 4.1.2 or 4.1.4, please upgrade to the latest version ( >= 4.1.2.11, >= 4.1.4.1 final). Current stable versions of SquirrelMail do not work with PHP5, but the CVS version contains fixes which get it working. See WhatPHPVersion and GettingPHP
  • Perl installed on the system. (If you don't have Perl, SquirrelMail will work fine but it's very helpful for the initial configuration. Alternatively, you can manually edit the configuration files.)
  • Unlike many PHP applications, SquirrelMail does not require MySQL or other database type.

     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

 

#squirrelmail-configure

 

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.

 

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.

 

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:

<VirtualHost 1.2.3.4:80>
ServerName mail.youydomain.com
ServerAlias mail.*
ServerAdmin
postmaster@yourdomain.com
DocumentRoot
/home/www/webmail
</VirtualHost>

Here's a breakdown of what's above:

<VirtualHost 1.2.3.4: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 1.2.3.4 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 postmaster@yourdomain.com - 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.

 

References

 

http://www.squirrelmail.org/wiki/SquirrelMail

 

More Webmail Software

 

http://openwebmail.org/

http://eaccelerator.net