SquirrelMail, a Web-Based Mail Serverby Glenn Graham
Client-based Mail Vs. Web-based Mail: A Case in Point
Historically, email has been the primary source of Internet communications. First there were text-based programs such as elm, pine, and mutt (for Unix). With the rise of Windows, email software such as Eudora, Netscape, and Outlook Express took the stage. All of these programs use the POP3 protocol to download messages from a remote server to the local drive.
As people (and laptops) become increasingly mobile, email solutions have become more demanding. Road warriors are tired of spending hours in hotel rooms configuring their email software.
Last year while traveling through Southern California, I stayed at a hotel that offered high-speed access. I connected my laptop to their network, attempted to send a message, and found my home (SMTP) settings wouldn't work. Next I tried changing my setting to the hotel's network, however it wouldn't accept outgoing connections. Luckily I had root access to my home system and was able to configure it to accept my SMTP request. What would an average user have done that, though?
Enter Webmail. It's simple, easy, and attractive to the average user. It doesn't require software (beyond a browser), configuration or headaches. Simply log in to the Web site and read your mail. This goes a long way to explain the popularity of advertising-supported services from major Internet companies.
I started my search for a Webmail solution at Freshmeat. After sifting through over 65 programs, I stumbled across SquirrelMail. It didn't have fancy screenshots, but to my surprise, had everything I needed. It's easy to install, runs right out of the box, and my clients love it. What else could I ask for?
SquirrelMail runs under Apache with PHP4 support installed. It requires
imapd running via
the event you need to run a database, you might consider compiling PHP with
MySQL support. Most commercial systems already have these features built in.
(If your Apache server hasn't already been built with PHP, see Darrell
Brogdon's article on the
subject, or read the PHP support documentation in the
SquirrelMail polls the mail queue,
parses the output via PHP to HTML using the Apache server. Authentication takes
place within the
/etc/passwd file when the user logs in with a
matching username and password. The administrator must add an
entry for each user. (Note: It's not yet possible to add accounts through the
Building and Installing Under FreeBSD 4.6.2-RELEASE (Latest version)
Before installing SquirrelMail, carefully read the documentation on their site. It outlines system and software requirements. Before installation, you must have the following components installed and operational:
Apache with PHP support (PHP4). Under FreeBSD, install
PHP4from the ports collection. Optionally, PHP4 may be downloaded from http://www.php.net/
sendmailversion 8.9.1 or later
inetd. Under FreeBSD install
cyrus-imapdfrom the ports collection
After that, you're ready to install SquirrelMail.
First, download the installation tarball and untar it to
Next, read the
INSTALLfile, noting the PHP compilation instructions. The installation doc is self-explanatory. If you're building PHP from source, though, you may wish to use either:
./configure --enable-track-vars --enable-force-cgi-redirect --with-gettext
./configure --with-apxs=/usr/local/sbin/apxs --with-mysql
Now, run the
./configurescript. Figure 1 below shows an example.
Figure 1: An example configuration screen
Remember to save your changes.
Move the directory structure (
./squirrelmail/) to the DocumentRoot directory from which you wish to serve SquirrelMail. The FreeBSD default is
Create a directory to store your attachments.
Change the mode of the
attachmentsdirectories to 755.
chmod 755 /usr/local/www/data/squirrelmail/data/ chmod 755 /usr/local/www/data/squirrelmail/attachments/
php.inifile to enable cookies, by setting
/etc/inetd.conf. Add or modify the appropriate line to read:
imap4 stream tcp nowait root /usr/local/libexec/imapd imapd
imapdsecurity to allow only connections from the localhost. This may be accomplished through tcpwrappers via
/etc/hosts.allow, or by building a custom firewall rule. (Note: If you do not have
imapdrunning, SquirrelMail will not function. Instead, you'll see PHP code in your browser.)
The appropriate entries in
# Imapd imapd : 127.0.0.1 : allow imapd : ALL : deny
Logging In and Testing for the First Time
Before logging in to test the system, remember to restart your Apache
server. To test your setup, visit the URL
http://YourServer.Com/squirrelmail/index.php. You should see a
login window resembling Figure 2.
Figure 2: The login window
To log in, simply enter a valid username and password for an existing email account on your system. As seen in Figure 3, the resulting page will show the contents of the default mail folder. You can click on the image for a larger view.
Before using SquirrelMail, remember to click on the options menu and edit (at a minimum) personal information containing your email address, signature, and other preferences.
It's a Nice Package
SquirrelMail is robust and featureful. For example, it effectively blocks HTML images embedded in mail from being downloaded to your desktop without permission. This is a customizable feature available under the options menu. Any unauthorized images will be replaced with a security block.
SquirrelMail also performs well. My first installation used a 200 MHz box with only 64MB of RAM. Although fine for development and testing, it was hardly powerful enough to run the application to serve several users at once. Within a day I upgraded the server to a 500 MHz machine with 128 megabytes of RAM and an ultra fast SCSI drive. The system comfortably accommodates 75 to 100 simultaneous logins without any noticeable loss to performance. The processor utilization averages between 30 to 40 percent.
As users become more and more finicky about the level of service they receive from providers, ISPs are under increased pressure to provide the access their clients demand. If you operate an ISP and don't support Webmail, perhaps it is time to start. SquirrelMail is an excellent solution.
Glenn Graham has been working with telecommunications since 1977.
Return to ONLamp.com.