How to set up Open WebMail in CentOS

I had originally written this tutorial for xmodulo.com
Webmail interface is one of must-have services for any mail server. Most of us are used to native email client software, but what if your favorite client software is not available for any reason? For example, you have left your laptop at home, or your phone's data plan just went dry, or maybe you are just travelling. An alternative way to access a mail service in such cases would be to use the webmail interface of your mail server. As long as there is web browser with Internet connectivity, you should be able to use the webmail interface.
Open WebMail is a lightweight, open-source webmail for Linux. The interface may be a bit old school, but Open WebMail provides the following features.
  • Custom folders
  • Mail filters
  • Changing passwords
  • Automatic mail reply (vacation/out of office responders)
  • Contacts
  • Support for large mailboxes
Open WebMail has its own repository for CentOS/RHEL/Fedora. Package for Debian is available in their site as well. However, as of this writing, the package for Debian does not work on Ubuntu due to dependencies issues.

Updating the Repository and Installing Open WebMail on CentOS

As usual, adding Repoforge repository is always recommended. The official repository for Open WebMail is added as well.
# cd /etc/yum.repos.d
# wget http://openwebmail.org/openwebmail/download/redhat/rpm/release/openwebmail.repo
Now, Open WebMail can be easily set up using yum command.
# yum install openwebmail perl-CGI httpd

Configuring Open WebMail

First of all, the file /var/www/cgi-bin/openwebmail/etc/dbm.conf is updated with the following parameters.
# vim /var/www/cgi-bin/openwebmail/etc/dbm.conf
## the previous values are overwritten ##
dbm_ext                 .pag
dbmopen_ext             none
dbmopen_haslock         no
Then Open WebMail can be initialized with an installed script as follows.
# /var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
The index.html file for Open WebMail is also prepared by using a soft link.
# ln -s /var/www/data/openwebmail/redirect.html /var/www/html/index.html
[Optional] The domain name for the mail server is defined manually to avoid any future mistakes in the @domain part of the mail address.
# vim /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
domainnames             example.tst
The Apache web server is restarted.
# service httpd restart
# chkconfig httpd on
Finally, Open WebMail can be accessed by pointing the browser to the URL of the mail server: http://mail.example.tst OR http://IP-Address-of-Mail-Server
Some screenshots are provided below.
Open WebMail login page:
Open WebMail interface:
Open WebMail preferences:

Troubleshooting Open WebMail

Open WebMail may generate errors or behave abnormally if specific versions of some Perl packages are not installed. Fortunately, the packages are available in Open WebMail repository and are very easy to install. The following demonstrates how to install problematic Perl packages.
A folder is created to store the packages. It could be any folder.
# mkdir /var/www/data/openwebmail/packages
# cd /var/www/data/openwebmail/packages
Packages are downloaded.
# wget http://openwebmail.org/openwebmail/download/packages/CGI.pm-3.05.tar.gz
# wget http://openwebmail.org/openwebmail/download/packages/MIME-Base64-3.01.tar.gz
# wget http://openwebmail.org/openwebmail/download/packages/Text-Iconv-1.2.tar.gz
Install CGI.
# tar zxvf CGI.pm-3.05.tar.gz
# cd CGI.pm-3.05
# perl Makefile.PL; make; make install
Install MIME.
# tar zxvf MIME-Base64-3.01.tar.gz
# cd MIME-Base64-3.01
# perl Makefile.PL; make; make install
Install Text-Iconv.
# tar zxvf Text-Iconv-1.2.tar.gz
# cd Text-Iconv-1.2
# perl Makefile.PL; make; make install
To sum up, Open WebMail interface may be a bit old school, but it is a complete package pre-built with often needed features. Besides, the installation process is easy, and the interface is very lightweight. Open WebMail is certainly a worthy candidate when a simple webmail interface is needed.
Hope this helps.

Comments