How I got UW-IMAP running on Windows XP

SpittingBull the.spitting.bull@gmail.com
Mon Jan 7 16:19:00 GMT 2008


Hi list!

Since this is my first post here I thought it might be kinda nice to
start with a tiny Cygwin success story.

Project: Establishing a neat IMAP server that can be used in Thunderbird 
as my central mail storage

Environment:
- Stand-alone Windows XP Pro SP 2
- Cygwin DLL version v1.5.24-2
- uw-imap packages: 2002e-3


First approach: Courier

The README.cygwin in the current Courier IMAP sources v4.3.0 made me 
think compiling Courier IMAP from scratch would be piece o'cake. Turns 
out that README.cygwin was kinda outdated. At the end of .configure 
(which took like 10 minutes) it simply says: you need Courier authlib first.

Tried to compile Courier authlib v0.60.2 two times with the exact same 
result: Zonelabs vsmon crashed during 'make' and Cygwin stopped 
responding. Figure that.


Second approach: uw-imap

Getting uw-imap to work isn't that big a deal. Make it following your 
orders is.

Hint list:

1. Windows XP and HOME
If you are running a stand-alone XP Cygwin seems to have a problem 
generating a proper HOME (your good if you're member of a domain). I 
installed Cygwin in C:\Programs\cygwin and my HOME was set to 
C:\Programs\cygwin\home.

I wanted my HOME to reside in my profile at C:\Documents and Settings. 
So a inserted the follwing command in cygwin.bat:

SET HOME=%HOMEDRIVE%%HOMEPATH%\cygwin

HOMEDRIVE and HOMEPATH are Windows XP user specific environment 
variables. Ah, and don't forget to create the sub-directory 
'C:\Documents and settings\<your profile>\cygwin'.


2. PATH
After I had a HOME I created a .bash_profile there with the following 
content:

#!/bin/bash
PATH="${PATH}":/usr/sbin:.

No magic here just convenience.


3. xinetd
I have a more or less solid Linux background soooo ... inetd stinks. 
Wanted xinetd. So here's the /etc/xinetd.d/imap config file you will 
need for uw-imap:

service imap
{
     socket_type        = stream
     wait            = no
     server            = /usr/sbin/uw-imapd
     user            = <your profile>
     protocol        = tcp
     disable            = no
}

Instead of <your profile> I used the name of my local user. Must be 
stored in /etc/passwd. I tried SYSTEM first but that didn't work: setuid 
- permission denied. I am sure there's a proper solution for this but 
since I'm the only user on my machine I am fine with as it is.


4. First test
I started xinetd in debug mode this way:

/usr/sbin/xinetd -d -filelog /var/log/xinetd.log

Then I launched Thunderbird and created an IMAP account. Bingo!


5. IMAP tricks
uw-imap created a directory 'Mail' in HOME after I created the IMAP 
account in Thunderbird. *BEFORE* I did anything else I opened the 
extended IMAP settings (Thunderbird: right-click IMAP account / 
settings) and set 'IMAP-Server-Directory' to 'Mail'. Attention: 
case-sensitivity!

What's that all good for? Well if you create a new folder for this 
account in your email client (i.e. Thunderbird) uw-imap will create a 
new MBOX in the Mail folder mentioned above instead of your HOME root.

Another thing in Server settings: uncheck everything regarding 'new 
messages'. uw-imap has a problem with INBOX. You will get a error (which 
is actually merely a warning) like: "SELECT failed: Can't open INBOX: 
not a selectable mailbox". I've googled for that issue. Let's just say: 
it's a known one.


6. Symlinks
You may want to add the following symlinks (if you plan to use say exim):

/var/mail pointing to your HOME/Mail and
/var/spool/mail pointing to /var/mail


7. Automizing it
I know there's more than one way to do that. Here's mine:

I created two scripts:

Windows XP: start-xinetd.bat

@echo off
echo Starting xinetd ...

SET HOME=%HOMEDRIVE%%HOMEPATH%\cygwin

C:
chdir C:\Programme\cygwin\bin

bash -l -c /usr/local/bin/startxi

echo xinetd started.


Cygwin: /usr/local/bin/startxi

#!/bin/bash
xinetd -filelog /var/log/xinetd.log

(don't forget to chmod +x /usr/local/bin/startxi  ;-)

start-xinetd will launch Cygwin, start xinetd as window process (check 
task manager) and terminate Cygwin / bash properly afterwards. You could 
include that script in Start / Programs / Autostart.


That's all so far. Do I have to say it? ... I love Cygwin!

Kind regards

Spitting Bull








--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list