Setting up Squirrel Mail webmail with Mercury
When I decided I wanted to offer webmail as well as email (via Mercury Mail),
I searched the web for a free webmail software. The only thing I could find
freee that would work with Mercruy was SquirrelMail at
http://sourceforge.net/projects/squirrelmail/
This page is about my installation of SquirrelMail Version 1.2.10 via
PHP-4.3.4-Win32 on my Windows2000 Server with Mercury32 running it's IMAP4
Server module.
-
I started this webpage on January 6th, 2003.
Everything, PHP, Merc IMAP and SquirrelMail are all on this one page. This
page is very scruffy, just like the install. You probably should just print
it out and get started.
-
I recently subscribed to the Mercury discussion list (see bottom of this
page) and, interested in webmail, found messages recommending
squirrelmail
It's free. And although it's not a slick commercial installation, it's free.
Also, when squirrelmail is working, Mercury (with IMAP4 running) accepts
it "no-problem", and, after all, it is free.
But setting up squirrelmail and getting it to work can be quite an adventure.
So I'm going to post my experiences here.
-
First, get Mercury to load the IMAP4 module. It's a piece of cake, it just
starts right up. Verify that you have the IMAP4 Server monitoring screen
showing. You'll want to see when you actually login. SM might error after
the login but at least you know it's working that far! (hitting the IMAP
server)
-
FROM HERE ON, FOLLOW THE DIRECTIONS WITH EACH COMPONENT, BUT REFER BACK TO
THIS PAGE AS YOU GO! Do it the way THIS page says, as it was developed while
trying to follow standard instructions. They don't all apply to us exactly
the way they say. For instance, you will be told to install PERL. Don't!
It turns out that you don't need it! Yikes!
-
You will need PHP which you download it at
http://www.php.net/downloads.php
There are two files, an INSTALLER and a ZIPfile.
Since we're running Windows, download the Installer and run it and
get PHP working. It will most likely install in C:\PHP\
Don't open the zipfile distribution yet! It does have other files needed
for squirreling, but you don't need these YET. Keep this simple. First
get PHP running.
The Installer puts in the CGI version which is the *.EXE
version. It works on my Windows2000 Server with IIS, which I keep updated,
it's January, 2003 as I write this. You will see comments in the PHP docs
and in others' comments about bugs being fixed when the person went to the
.DLL version but I believe they also coincidently fixed something else
that made it work so it "looked like" their going to the .DLL version
is what did it. I held out and kept the .EXE and worked on the bugs and Voila,
it worked, so I think it just very well could have been config stuff all
along.
YOU DON'T NEED TO INSTALL PERL! But if you want to play around with it,
OPTIONALLY install Active State perl.
http://www.activestate.com You don't
need the Perl even though documentation sort of sounds like you do. The perl
just does one configuration thing but you'll end up editing that text-config-file
by hand anyway, before you're done.
Installation: use the default values.
"Please enter the address of your SMTP server" -- localhost is default.
"Please enter the 'from' address for the mail function." me@localhost.com
is default in the box.
may need to set permissions -- usually IUSR_MachineName (or user web server
runs as) will need read write access to the uploadtmp and session directories
and execute access for php.exe and php4ts.dll.
Create that WEBMAIL directory off your main domain's directory/folder:
D:\html\listserver\webmail
IF YOUR WEBMAIL WILL BE SERVICIING MORE THAN ONE DOMAIN, in
IIS, I create a website names WEBMAIL and then point webmail.listserver.info
webmail.otherdomains etc to
D:\html\listserver\webmail
which is where you will be installing Squirrellmail.
-
php.ini has to have session.use_cookies = 1, and have register_globals set
to ON
-
Add the index.php to the default document types in IIS webserver -- either
for the default webserver or the named WEBMAIL website.
-
Check the permisions of directories used for data and temp files. Webserver
user must have write access there. Since the install I'm describing puts
the files in directories or domain/WEBMAIL then the permisssions are right
in IIS for WEBMAIL. You might require Script permission in IIS.
-
C:\PHP\install.txt contains instructions for a "test" script to see if you
PHP is working.
Or save http://listserver.info/webmail/testphp.txt as test.php in your webmail
directory.
-
Once you have PHP running unzip the PHP distribution ZIP. If you use WinZip,
it will want to unzip to /PHPversionblahblahblah/. Let it. It's not the same
place your PHP C:\PHP\ but that's ok. Then copy (or xcopy, if you're a
real computist) all the files AND folders to the C:\PHP\ directory.
I know this sounds weird but the default "Installer" dir is C:\PHP\ but the
zip wants to go somewhere else. Clutzy, huh?
Now follow the instructions in the Squirrelmail INSTALL file.
1. In you php.ini in your Windows directory,
make sure session.use_cookies is 1
verify your session.save_path -- and your uploads config.
-
When you have PHP and squirrelmail running and you can see the login page,
try to login. You will probably receive this message: You must be logged
in to access this page.
When you do, verify in the IMAP4 Server monitoring screen in Mercury that
you logged in (actaully "hit") to the Mercury IMP4 Server.
If you have NOT logged in ("hit") to Mercury, something is wrong and you
need to go back and find out what it is before moving forward.
If you did login to Mercury and you DO have an error in squirrelmail after
the login, then it's probably the redirect fix you need to do.
Here's how to do it.
You need to replace/change one line in src/redirect.php file.
You can cut-and-paste from this popup file:
snippet.txt Or download an
already-fixed and rename it to your src/redirect.php
Version 1.2.10 file
re1210.txt
Version 1.4.1 file
re141.txt
This redirect fix was initially described at
http://sourceforge.net/tracker/index.php?func=detail&aid=542724&group_id=311&atid=100311
-
Here are more comments, which I will integrate into webpages soon:
I received the You must be logged in to access this page. in error
until I changed PHP.INI from
doc_root = D:\htmlwww\listserver\squirrelmail
to
doc_root = D:\htmlwww\listserver
Apparently it wanted the directory below the SM directory.
By the way,
D:\htmlwww is the root of my webserver.
D:\htmlwww\listserver is the root of this domain.
D:\htmlwww\listserver\squirrelmail is the SM (squirrelmail) directory.
PHP.INI apparently wants the root of either the operating domain or what
would be the root of the directory that Squirrelmail is working out of.
LATER COMMENT: I am currently running with doc_root commented-out in
windowsdirectory/php.ini. Try that.
It's funky that the You must be logged in to access this page. error
happens both when
the redirect fix is not applied OR the doc_root is not set right!
Fix one and I still get the error, so I think, ah, that's not
it and put it back. Wrong!
Do *both* and then check.
Once logged in to SquirrelMail, all was well until I tried to Send a message.
Trying to Send brought on a REMOTE_PORT error.
The "fix" described at the webpage link below, is aimed at three files, but
I found that fixing only draft_actions.php worked great. If I fixed the other
files, I ended up with other errors.
Try doing only draft_actions.php first. It worked for me!
If I do it in the other two files, as instructed, as well, I get other errors.
I put those two files back to original, only fixing draft_actions.php
and now I have no errors.
You also simply download my
draft-a.txt and rename it to
your src/draft_actions.php
The orignal fix thing is described at:
http://www.squirrelmail.org/wiki/en_US/InstallingSquirrelMailWindowsIIS
If you try 'fixing' the two other files, please tell me about your results.
Once I had mine "almost" working I kept getting the errors "Header already
sent" and errors like that. I don't remember exactly what I did to make them
go away, but basically, it was failing at this point because I had told it
to report all errors. So it did and that made the setup not work -- it was
reporting minor unimportant errors instead of running. When I got it to stop
reporting all errors, Squirrelmail is working great. I'm sorry, but since
it's the last thing I did to make it work, I forgot to write here what I
did... but it was something simple.)