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) for maximum compatibility across browsers. It has very few requirements and is very easy to configure and install. SquirrelMail has a all the functionality you would want from an email client, including strong MIME support, address books, and folder manipulation. For more information, Please see http://www.squirrelmail.org

To install squirrelmail port, run the following command:

# cd /usr/ports/mail/squirrelmail
# make install clean

This will install Squirrelmail in /usr/local/www and install all required modules. Now what we will want to do is symlink the webmail location. The reason why we are doing it this way is because we won't want to move the squirrelmail folder to your webmail location as that will make portupgrading harder for you. If we symlink it, It's kinda like an alias.

# ln -s /usr/local/www/squirrelmail/ /usr/local/www/apache22/data/webmail

Configuring Squirrelmail

Now we need to configure squirrelmail. Run the following commands to get into setup mode:

# cd /path/to/webmail/config
# ./conf.pl

You will be presented with a menu. Under 1 - Organization Preferences, Any one of the setings inside this window are optional. When you are done, hit S to save and then hit Enter and then hit R to go back to the Main Menu.

Now we want to go to 2 - Server settings. Hit 1 for Domain and hit Enter on the keyboard. You can type the name of the server or the local IP or public IP, whichever you prefer. If your mailserver is behind a router/firewall, I use the local IP. If you are on the public side of things, the hostname or the static IP will work fine. If you are using a dyndns service like dyndns.org, I would highly suggest using the local ip and putting your qmail server behind a router/firewall.

Under Server settings we want to use the following. Please change x.x.x.x to the IP of your mail server:

1. Domain : x.x.x.x
2. Invert Time : false
3. Sendmail or SMTP : Sendmail

A. Update IMAP Settings : localhost:143 (other)
B. Change Sendmail Config : /var/qmail/bin/sendmail

Hit Y and then hit Enter. Hit S to save and then hit Enter again. Hit Q to quit and exit the menu.

Now lets setup ownership for squirrelmail attachments:

# chown www:www /var/spool/squirrelmail

And then setup php.ini (If it isin't already):

# cd /usr/local/etc
# cp php.ini-recommended php.ini

Testing Squirrelmail

If you happen to see this error when browsing to the squirrelmail site:

Fatal error: Call to undefined function: preg_replace() in /usr/local/www/apache22/data/functions/global.php on line 165

Install the following port

# cd /usr/ports/devel/php4-pcre
# make install clean

Just to make sure Squirrelmail is working okay, we will want to run the config test. Do this by going to the following url. http://your-squirrelmail-location/src/configtest.php. Replace the your-squirrelmail-location with your ip or your hostname. This will tell you if squirrelmail is setup correctly. If you see this:

ERROR: Error connecting to SMTP server "localhost:25".Server error: (0) Unknown error: 0

This is okay. The server is able to accept messages on port 25 for anything in locals or rcpthosts or relaying via TLS. When you are completed with installing squirrelmail you should install the change_pass-2.7-1.4.x plugin so you can change passwords with courier.