I tend to work from several locations, and I like having access to my mail folders from everywhere. Some of my mail comes from POP accounts, but I also have access to an IMAP server. For a while, I used to store "active" conversations on the IMAP server, and periodically archive them in the mbox folders at home to stay within my alloted mail quota. This meant that if I wanted to look at an older message, I basically had to ssh to my home box and dig it out.
I finally got tired of moving e-mails back and forth and decided to set up an IMAP server on my home box. Which server to use? I've been using mbox folders for a long time and wasn't about to convert to Maildir, which ruled out Courier. After a bit of searching, I found UW IMAP. I've always been a fan of pine, so I tend to trust mail software from the University of Washington.
An apt-get install uw-imapd later, I was faced with a server that installs no configuration files in /etc and no service script in /etc/init.d. The latter puzzle was easy to solve: UW-IMAP expects to be called from inetd or xinetd and conveniently appends to /etc/inetd.conf, so apt-get install inetd is enough to enable this service. I fired up Thunderbird, and defined a new IMAP account; Thunderbird was able to connect, but authentication failed.
I next turned to the IMAP FAQ, and found out that UW-IMAP prides itself on needing no configuration; meaning that, if you need to change things like the user's mail directory (which annoyingly defaults to the user's home and exports the entire directory tree), you have to recompile the package.
I also learned that, in fact, there is one configuration file: /etc/cram-md5.pwd, to be filled with usernames and passwords (one pair per row, tab-separated). Since I did not install the IMAP SSL package, cram-md5 is the only way to retain some security, otherwise passwords are sent in clear over the network. Thunderbird has an option to force CRAM MD5 authentication in the account settings dialog.
I was finally able to connect to the IMAP server, but now the folder list included every file in my home directory, since, as I mentioned, UW-IMAP's idea of the mail store is the user's entire home. To solve this, you can use "mail" as an IMAP server path (Server settings > Advanced in Thunderbird).
But some programs don't have this option or ignore the setting (Opera's M2 seems to do that). Another solution involves a hack; create a dummy user (say joe-mail if your login is joe) with the same UID and GID as the real user, and with a home directory in the desired location:
id joe # your login name
# note the uid and gid, then
sudo useradd -u $uid -g $gid -d /home/joe/mail joe-mail
After updating /etc/cram-md5.pwd and Thunderbird, I was finally able to read mail from my home IMAP server. UW-IMAP has some counter-intuitive defaults, but, once you know what to do, is quite easy to tweak.
Update: apparently, dovecot-imapd (recommended by two readers) and cyrus-imapd might be easier to set up, but I've already spent enough time tending to UW-IMAP, so I'm not touching it. Feel free to comment if you have used other servers.