8. SquirrelMail

In addition to IMAP and POP3, most end-users will be glad to have also web-based access to their mailbox. Therefore, we will install SquirrelMail, a standards-based webmail package written in PHP, with built-in support for the IMAP and SMTP protocols. It is written for maximum compatibility across browsers and has very few requirements; SquirrelMail is very easy to install and configure and provides a lot of plugins to allow administrators to deeply customize its look and feel.

As an excellent alternative, you may want to have a look at RoundCube, also available through OpenBSD ports and packages.

Please note that the webmail software doesn't have to necessarily reside on the mail host: indeed, if you have a dedicated web server available, that's certainly the best place to install it.

8.1 Preliminary steps

The required packages are:

If PHP wasn't already installed on your system, don't forget to enable it, as well as the mbstring module:

# ln -s /var/www/conf/modules.sample/php5.conf /var/www/conf/modules
# ln -fs /var/www/conf/php5.sample/mbstring.ini /var/www/conf/php5/mbstring.ini

You also have to uncomment the following line in the Apache configuration file, /var/www/conf/httpd.conf:

/var/www/conf/httpd.conf
AddType application/x-httpd-php .php

and restart Apache:

# apachectl restart
/usr/sbin/apachectl restart: httpd restarted

8.2 Installation and configuration

Now we can download SquirrelMail, extract it inside Apache's chroot and give the newly-created directory a nicer name:

# tar -zxvf squirrelmail-x.x.x.tar.gz -C /var/www/htdocs
# mv /var/www/htdocs/squirrelmail-x.x.x /var/www/htdocs/webmail

Next, we need to create three directories:

# install -d -o www -g www  /var/www/squirrelmail/data
# install -d -g www -m 730 /var/www/squirrelmail/attachments
# install -d -o www -g www -m 700 /var/www/tmp

Further configuration can be easily managed through a menu-driven Perl script, /var/www/htdocs/webmail/config/conf.pl. Some of the parameters you will certainly have to customize are:

Organization Preferences -> Organization Name
The organization name, which will appear here and there in the web pages.
Server Settings -> Domain
The domain name.
General Options -> Data Directory
The pathname to the directory in which user preferences will be stored (in our case /squirrelmail/data/).
General Options -> Attachment Directory
The pathname to the directory in which attachments will be temporarily stored (in our case /squirrelmail/attachments/).
Set pre-defined settings for specific IMAP servers -> courier
Enable the predefined settings optimized for Courier-IMAP.