< Day Day Up > 

Providing Web-Based Email Access

Although imap and pop are certainly popular choices for getting email to your clients, providing a web interface is a virtual necessity nowadays. A web-based client enables users to check their email from any web-enabled computer without needing to set up any additional software. In this section, we'll look at how you can quickly set up SquirrelMail a popular web-based IMAP client that works with PHP. As a prerequisite, you'll need PHP activated, as described in Chapter 24.

Installing SquirrelMail

To begin, download the latest SquirrelMail distribution from and unarchive the code into a web-accessible directory, such as /Library/Webserver/Documents. You'll also want to remove the version number from the directory so that squirrelmail will be easier to access (for example, rename squirrelmail-1.5.0 to squirrelmail).

Next, you'll need to prepare a data and attachments directory to store user information. Enter the following commands from within the main squirrelmail directory to prepare these storage locations:

 brezup:jray squirrelmail $ sudo chown -R www:www  data brezup:jray squirrelmail $ sudo mkdir /var/attachments brezup:jray squirrelmail $ sudo chgrp -R www /var/attachments/ brezup:jray squirrelmail $ sudo chmod 730 /var/attachments 

SquirrelMail now has everything it needs to run except a valid configuration file.

Configuring SquirrelMail

For SquirrelMail to operate, it needs to know what IMAP server it should communicate with, which SMTP server to use as a relay, and so on. SquirrelMail can even be personalized with organization logos and other custom settings. The configuration is handled by a menu-driven Perl process found in the config directory. To run, cd into config and type sudo ./

 brezup:jray squirrelmail $ cd config brezup:jray config $ sudo ./ 

You should now see the main menu of the setup tool, similar to this:

 SquirrelMail Configuration : Read: config.php (1.4.0) --------------------------------------------------------- Main Menu -- 1.  Organization Preferences 2.  Server Settings 3.  Folder Defaults 4.  General Options 5.  Themes 6.  Address Books (LDAP) 7.  Message of the Day (MOTD) 8.  Plugins 9.  Database 10. Language settings 11. Tweaks D.  Set pre-defined settings for specific IMAP servers C.  Turn color on S   Save data Q   Quit Command >> 

You can explore the settings and customize the system to your heart's content. The Organization Preferences option enables you to personalize the system for your group or company; the Folder Defaults option provides control over the default IMAP folders and what should happen to messages that have been deleted; the Themes option controls the look and feel, and so on. We are concerned with getting the system communicating with the IMAP server you've setup. To do this, press 2 and then press the Return key.

The menu should refresh to display server settings:

 SquirrelMail Configuration : Read: config.php (1.4.0) --------------------------------------------------------- Server Settings General ------- 1.  Domain                 : 2.  Invert Time            : false 3.  Sendmail or SMTP       : SMTP A.  Update IMAP Settings   : localhost:143 (uw) B.  Update SMTP Settings   : localhost:25 R   Return to Main Menu C.  Turn color on S   Save data Q   Quit 

Start by setting your domain. Press 1 and then press the Return key. When prompted, enter your server's domain name. The default settings for items 2 and 3 should be fine. Next, configure your IMAP server settings by pressing the A key and then the Return key. The menu will change slightly to show additional options:

 SquirrelMail Configuration : Read: config.php (1.4.0) --------------------------------------------------------- Server Settings General ------- 1.  Domain                 : 2.  Invert Time            : false 3.  Sendmail or SMTP       : SMTP IMAP Settings -------------- 4.  IMAP Server            : localhost 5.  IMAP Port              : 143 6.  Authentication type    : login 7.  Secure IMAP (TLS)      : false 8.  Server software        : uw 9.  Delimiter              : detect B.  Update SMTP Settings   : localhost:25 H.  Hide IMAP Server Settings R   Return to Main Menu C.  Turn color on S   Save data Q   Quit 

Use numbers 4 and 8 to configure the hostname of your server (localhost or if you're running SquirrelMail on the same machine as your IMAP server) and the server software itself (uw for the University of Washington IMAP daemon).

Use a similar process to update the SMTP settings: Press B to display the settings, and then update the SMTP hostname to reflect the system running Postfix.

When finished, press R to exit to the main menu.

One final change and you're finished. Press 4 to enter the General settings:

 SquirrelMail Configuration : Read: config.php (1.4.0) --------------------------------------------------------- General Options 1.  Data Directory              : ../data/ 2.  Attachment Directory        : /var/attachments/ 3.  Directory Hash Level        : 0 4.  Default Left Size           : 150 5.  Usernames in Lowercase      : false 6.  Allow use of priority       : true 7.  Hide SM attributions        : false 8.  Allow use of receipts       : true 9. Allow editing of identity   : true/true 10. Allow server thread sort    : false 11. Allow server-side sorting   : false 12. Allow server charset search : true 13. PHP session name            : SQMSESSID R   Return to Main Menu C.  Turn color on S   Save data Q   Quit Command >> 

Use the 2 option to set the attachments directory for SquirrelMail. This should be configured to /var/attachments, which was created earlier in the setup process. After making the change, press S to save your configuration, and then press Q to quit. SquirrelMail is now ready for use.

Accessing SquirrelMail

To use SquirrelMail, simply point your web browser at the URL where the squirrelmail directory was installed. You should see a basic login screen, as shown in Figure 26.1.

Figure 26.1. SquirrelMail should present a login screen for your IMAP server.

Enter your Tiger username and password and, after a few seconds the screen should refresh with a familiar email client display. Mailboxes and folders are shown on the left, a message list on the right, and the message content displayed when an entry in the list is clicked, as shown in Figure 26.2.

Figure 26.2. SquirrelMail works just like a traditional email client.

As you use SquirrelMail, you'll discover that it offers a very full IMAP experience. Folder management, attachments, searching, and many more features are all accessible from any web browser that can connect to your server.

You're now well on your way to having a mail server as capable as any commercial offering.


One small problem that you might encounter is that by using the /var/attachments directory, you provide a more secure service to your users, but SquirrelMail cannot clean up abandoned attachments in this directory. To automatically clean things up, you might want to add a crontab entry such as rm -f /var/attachments/* that runs at a time when no one will be using the server. Chapter 12 contains more information on setting up cron-invoked processes.

     < Day Day Up > 

    Mac OS X Tiger Unleashed
    Mac OS X Tiger Unleashed
    ISBN: 0672327465
    EAN: 2147483647
    Year: 2005
    Pages: 251 © 2008-2017.
    If you may any questions please contact us: