What You're Trying To Achieve
A Linux box running Apache, PHP and Squirrelmail, which connects with a Mercury Mail Server running on a Windows box, on the same network, so that users can read and send emails through a web browser, from any computer that has an internet connection.
Typically, you will have some form of router which is allowing port 80 into your network.
This port is directed to the IP address of the Linux box.
If you decide to run Squirrelmail from the web document root directory (i.e., var/www/html), you should be looking at the logon screen of Squirrelmail.
Once logged in, Squirrelmail will then show your new emails, if any that are being stored in Mercury as well as allowing you to reply, send new emails, etc.
Step 1 - Linux Install
- Linux -
I recommend using Red Hat 9 as it comes with Apache, PHP, and Squirrelmail (how handy is that). Select
Custom Install and make sure that you select these options in the install process. Apache is often referred to as 'Web Server'.
Once installed, type
service httpd status to check if Apache has started. If Apache (i.e. the hpptd daemon) is stopped, type
service httpd start which will start the web service. However the service may not automatically start on server boot. To fix this, type
ntsysv, scroll to the
httpd entry and spacebar to put an asterisk next to it. Tab to save and exit. The Web service will now start automatically on boot.
Start an X-windows session (
startx). Test that you can see Apache's default page from a browser window using the web address http://127.0.0.1. The default APache page should be visible.
- PHP -
To be certain that PHP works, create a file called test.php in your web document root directory (i.e., var/www/html). Using a text editor, place the following text in the file:
<?php phpinfo();?>
Save and close the document. Open a browser window and go to http://127.0.0.1/test.php. If you see a detailed, fancy webpage with lots of information about your PHP installation then PHP is working. Verify that the
IMAP and
gettext extensions are working by finding them listed on the page.
Step 2 - Squirrelmail Install
Obtain the latest binaries from the
SquirrelMail Website
Copy the Suirrelmail directory from (i.e., usr/share/squirrelmail) to the web document root directory (i.e., var/www/html)
Next locate a file called
config_default.php which now should be located in var/www/html/squirrelmail/config
Rename
config_default.php to
config.php
Open
config.php with a text editor
Locate the following line:
$smtpServerAddress = 'localhost';
Change
'localhost' to the IP address or domain name of your SMTP server
Locate the following line:
$imapServerAddress = 'localhost';
Again change
'localhost' to the IP address or domain name of your SMTP server
Save config.php
Create the following directory
var/www/html/squirrelmail/data
Copy
default_pref from
var/lib/squirrelmail/prefs to
var/www/html/squirrelmail/data
Change permissions on the
/data directory to
Everybody, Full Control
Step 3 - The Big Test
Open up a web browser on your Linux box and point it to the following URL:
http://127.0.0.1/squirrelmail/index.php
With any luck you should be looking at the logon screen of Squirrelmail. Enter a valid username and password that has been setup in Mercury and 'Bob's Your Uncle', webmail in all its glory.
A Real Life Senario
A company has a static outward facing IP address on the router, with Port 80 open to the internet. All port 80 traffic is directed by the router to the Linux box, via a forwarding rule. The result is that staff are able to read and send emails from any computer with an internet connection, by simply typing in the following address in their web browser:
http://[company's IP address]/squirrelmail/index.php
Conclusion
So you've set up up a webmail service for nicks, saving your company thousands of dollars by not purchasing Microsoft Exchange and have contributed to the efficiency and convenience of email communication for your fellow staff. It must be time for a pay rise!
- A.