jon parise // saturday, september 22, 2018

A Webmail Solution Using IMP

Jon Parise <jon@csh.rit.edu>

Abstract

The current trend for corporate or university intranets has been leaning towards web-based interfaces for quite some time, thus heralding the introduction of all sorts of web-based applications. Web-based email clients have become incredibly popular, especially with the introduction of services such as Hotmail and Zcentral, and most users feel comfortably managing their email in a familiar browser interface. To meet the needs of sites not wanting to develop their own custom webmail program, IMP was designed to be as complete and user-friendly a webmail interface as possible.

History

As a student programmer at the Rochester Institute of Technology, I was tasked with implementing some sort of web-based email client. The idea was to get students and faculty to use the webmail system when they were out of their dorms or offices (in the labs or library, for example), and thus eliminate the need for installing and maintaining a dedicated messaging client (Netscape Messenger, in our case). The same need is also apparent is most corporate intranets where employees might find themselves away from their desks and in need of accessing their email accounts.

Already being familiar with PHP (http://www.php.net/), I started to investigate pre-existing solutions and immediately stumbled upon IMP (http://horde.org/imp/). Developed by Chuck Hagenbuch for use at Williams College (http://wso.williams.edu/), it fit our needs exactly. IMP was in active development and already contained most of the features for which I was looking, so I began to toy with the distribution and soon found myself contributing back to the project.

Within the past year since my first introduction to IMP and the Horde Project, the product has advanced phenomenally. Features such as LDAP directory searches, individual user preferences, spell checking, session management, MIME handling, folder management, address books, internationalization, ease of installation, and user interface have all undergone vast improvements. IMP has been adopted by universities, corporations, and web presences all over the world to fill the need for a scalable web-based email client, and its development is more active than ever.

Background

The primary requirement for setting up an IMP installation is a PHP-enabled web server, Apache (http://www.apache.org/) being, by far, the most popular. IMP uses the IMAP protocol to access a user's mailbox and folders. This requires PHP's IMAP module to be included in the installation. Also, some of IMP's more advanced features (such as LDAP searching) will require additional PHP modules be included, as well.

An IMAP server is, of course, required. Several IMAP servers are available for BSD, but the two most popular are Washington University's IMAP server (http://www.washington.edu/imap/) and Carnegie Mellon's Project Cyrus (http://asg.web.cmu.edu/cyrus/).

In order to allow users to store personal preferences and address books, an SQL database is required. MySQL (http://www.mysql.com/) seems to get the best support, as that is what most of the developers use, but most major SQL implementations are supported. Additional storage solutions are currently being explored.

The newest IMP code supports fairly advanced session management. This requires some sort of backend storage, preferably an SQL database, although dbm, shared memory (SysV), and LDAP also work at the moment.

The user will only need a web browser. We've traditionally had better luck with Netscape Navigator's handling of cookies and Javascript, but we make a strong attempt to ensure compatibility with Internet Explorer, too. Lynx support is marginal, although every so often someone will go on a crusade to improve it.

For further information on designing a highly scalable webmail system, consult the Scalable Webmail HOW-TO (http://www.horde.org/papers/Scalable_webmail_HOWTO.html), written by Jason Belich (macmaster@pobox.com). It details the construction of large webmail installation using IMP and goes into more design particulars than I've covered here.

Implementation

Because IMP is dependent on PHP, we'll begin there. There are numerous resources available for building PHP and Apache, so I won't venture into detail on that. Make sure you include IMAP support in your resulting build. You'll need to link against Washington University's c-client library to get it to work. If you're planning on using some of the storage-dependent features of IMP, you'll also need to make sure you include the appropriate support in PHP (MySQL and LDAP), for example. Most of the required libraries are available in FreeBSD's ports tree.

If you have doubts as to whether a PHP module was correctly installed, a handy trick is to create a simple web page (phpinfo.php3) containing:


    <?php phpinfo(); ?>

Viewing phpinfo.php3 will call the phpinfo() function and display PHP's current configuration in the browser. This is useful for various debugging tasks. (Note: 'mod_imap' refers to Apache's image mapping support, not PHP's IMAP (mail protocol) module.)

Assuming you have a PHP-enabled Apache binary up and running, you're ready to install IMP. You'll need to download both the latest Horde and IMP packages to get IMP to work correctly. Both are available from ftp.horde.org or from the mirror sites listed on www.horde.org/mirrors/.

Assuming you want to have IMP available as webmail.domain.com (as most administrators apparently seem to prefer, judging by the number of questions asked on the IMP mailing list), you'll want to install the distribution similar to:


    /var/www/horde
    /var/www/horde/imp

You'll want to point your DocumentRoot at '/var/www/horde/imp' and set an Alias of '/horde' to '/var/www/horde'. This structure is required because Horde is, in fact, the logical and functional parent of IMP.

You'll want to consult the distributed INSTALL document to complete the installation process. I won't detail here because IMP is rapidly evolving and the installation procedure often undergoes revisions. Most of the installation process is encapsulated in the provided web-based setup.php3 script to help make your life easier, though.

Configuration

The setup script will handle the setting of the most common configuration variables, but there are many configurable aspects of IMP. All of the configuration files are located in the config/ directory and can be editing with a text editor.

Customization

IMP is designed to be completely customizable, to the point where we've even started to develop HTML theme support in the latest development branch. An effort has been made to keep all of the HTML output in the templates/ directory, free to be edited to change the look or layout of the interface.

International language support has been added in IMP. Numerous translations are already available, and new localizations are constantly being contributed back to the project. Administrators can even override some or all of the language strings by using the locale/local/ directory.

Conclusion

IMP has proven itself to be a highly customizable, scalable webmail solution. It has been implemented on installations supporting as many as 40,000 users. The development effort is very strong, and the user support is excellent. And, above all, the project is free (GPL'ed), unlike to many other web-based messaging solutions.

Acknowledgements

  • Chuck Hagenbuch, Mike Hardy, Ivan E. Moore II, and the rest of the Horde team
  • RIT's Computer Science House (http://www.csh.rit.edu/)
  • RIT's Information Systems and Computing department

References