Subject: Help Running UW-IMAPD Under Cygwin

From: overbored <[email-masked]>
Date: Sat, 28 Aug 2004 23:51:32 -0700

I'm trying to get an IMAP server running, and it seems my only option 
today is uw-imapd. The cygwin package for that is installed, and I 
created an 'imap' file under xinetd.d with the following:

# default: off
# description: The IMAP service allows remote users to access their mail 
using \
#              an IMAP client such as Mutt, Pine, fetchmail, or Netscape \
#              Communicator.
service imap
{
         socket_type             = stream
         wait                    = no
         user                    = root
         server                  = /usr/sbin/imapd
         log_on_success  += HOST DURATION
         log_on_failure  += HOST
         disable                 = no
}

But I cannot make any connection to localhost:143 (nothing listening). I 
can connect to the other xinetd services fine (ftp), just not this one, 
and I've checked that 'imap' was in /etc/services. I've done a ton of 
searching to get where I am, but now I'm at a dead end. Any ideas?

Another thing...how easy is it to configure UW-IMAP? From what I've 
read, it seems that *everything* is configured in the source or Makefile 
(no conf files, etc.). And if I'm not mistaken, UW-IMAP does not 
directly support Cygwin, and had to be ported over. However, 
/usr/share/doc/Cygwin/uw-imap-2002e.README says the author (Abraham 
Backus) further modified it from what's on 
http://sourceforge.net/projects/uw-imap-cygwin/, so what exactly should 
I be modifying? The canonical homepage just points to the original 
UW-IMAP site. I looked for but didn't find any personal website of 
Abraham Backus.

Please let me know if any further info is needed. Thanks in advance!
-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Jim Riggs <[email-masked]>
Date: Sun, 29 Aug 2004 13:17:35 -0500

> But I cannot make any connection to localhost:143 (nothing listening). 
> I can connect to the other xinetd services fine (ftp), just not this 
> one, and I've checked that 'imap' was in /etc/services. I've done a 
> ton of searching to get where I am, but now I'm at a dead end. Any 
> ideas?

Did you restart or kill -HUP xinetd after creating the imap file?  What 
do the xinetd log entries in syslog say?  It should pick up the new 
imap service...

- Jim

---

From: overbored <[email-masked]>
Date: Sun, 29 Aug 2004 15:58:37 -0700

I figured out that problem, but now I have another few (hopefully quick) 
questions about IMAP in general:

(1) I can log in, but I have no idea where the mail is. I can do an 'a 
examine inbox' (meaning 'inbox' exists, since 'a examine asdf' doesn't 
work), but where exactly is this inbox? The /var/mail directory doesn't 
exist, and there's no file on my file system called 'inbox'. 'a list "" 
*' seems to recursively list everything under my home dir.

(2) I'd like to migrate my existing mail store (mbox format) to this 
IMAP. From what I've read, it seems that UW-IMAP also stores its 
messages in mbox format. But there's also a program called tmail to 
inject messages into IMAP. Can I just copy over my existing mbox files 
to wherever IMAP stores the messages (see #1), or do I have to use 
tmail? If I need to use tmail, how does one manually use it? Do you just 
pipe mbox data into it?

(3) I would like to have mail coming from various POP accounts going 
into my IMAP mailboxes. I have learned how to use getmail; if I would 
like to use this with UW-IMAP, do I need to configure it to use tmail, 
or directly write to the mbox files? I've read somewhere about locking 
issues; is this the reason why tmail is needed?

(4) (This is more of an IMAP protocol question.) I glanced at the RFC 
for IMAP. Is there the concept of views/search folders/dynamic filters? 
It seems that the 'mailbox' concept is like a folder, in that a message 
can only belong to one. The closest thing I could find was the 
attribute, but it was intended for things like 'read', etc.; can this be 
used for the above purpose, or is IMAP not a good protocol to use for 
searching?

Thanks!!!

For anybody curious about my original problem, the Cygwin syslog is 
accessed via the Event Viewer. From that I determined the problems:

- the permissions on the /etc/xinetd.d/imap file
- the CRLF line terminators in that file
- the 'root' user doesn't exist on my system (had to use SYSTEM)

---

From: Mark Crispin <[email-masked]>
Date: Sun, 29 Aug 2004 22:28:45 -0700 (PDT)

The first thing that you must realize is that UW imapd was not developed 
for Cygwin; it was developed for UNIX.  Cygwin gives a UNIX-like 
environment under Windows, but it is not UNIX.  This fact is important in 
understanding various issues.

I should also note that there is a native Windows build.  For those who 
want to use UW imapd under Windows, I recommend using the native build 
rather than Cygwin.  Some things are known not to work under Cygwin, 
because Cygwin is not a complete/100% accurate implementation of UNIX.

On Sun, 29 Aug 2004, overbored wrote:
> examine inbox' (meaning 'inbox' exists, since 'a examine asdf' doesn't work), 
> but where exactly is this inbox?

It is very possible that no file for INBOX exists.  In that case, INBOX 
(which always exists in IMAP) is empty.  UW imapd will notice when an 
INBOX file is created and messages are put in it, and then the IMAP INBOX 
will go non-empty.

Normally, an INBOX in UNIX will be the user's traditional UNIX format 
mailbox file in spool directory (e.g. /var/mail).  This is one of those 
"not complete/100% accurate" issues that I alluded to above.  An INBOX can 
also be one of several format-specific files (read the documentation about 
various mailbox formats); however note that only the mbx driver has been 
made to work under Cygwin and there are known Cygwin issues which break 
the other drivers.

Perhaps at this point you're starting to recognize why I suggest using a 
real UNIX system, or the native Windows build, rather than Cygwin...

> 'a list "" *' seems to 
> recursively list everything under my home dir.

This is normal behavior, and is discussed in the FAQ.

> (2) I'd like to migrate my existing mail store (mbox format) to this IMAP. 
> From what I've read, it seems that UW-IMAP also stores its messages in mbox 
> format. But there's also a program called tmail to inject messages into IMAP. 
> Can I just copy over my existing mbox files to wherever IMAP stores the 
> messages

Yes.  tmail is for mail delivery.  What you're doing is copying messages.

Note that the native Windows build can also read traditional UNIX mailbox 
format; although it would be better if you transfer those files in ASCII 
mode so they are in CRLF format.

> (3) I would like to have mail coming from various POP accounts going into my 
> IMAP mailboxes. I have learned how to use getmail; if I would like to use 
> this with UW-IMAP, do I need to configure it to use tmail, or directly write 
> to the mbox files?

I don't know anything about getmail.

> I've read somewhere about locking issues; is this the 
> reason why tmail is needed?

tmail is for mail delivery (being called from sendmail or whatever SMTP 
server you are using).  That is not the same as copying mail from a POP 
server.

The locking issues are that Cygwin implements locking like Windows 
(surprise!) rather than like UNIX.  The native Windows build knows about 
this, and the native Windows drivers use Windows style locking.  The UNIX 
build, which is what Cygwin uses, thinks that locking is UNIX style, but 
in actuality Cygwin just has a subroutine which looks like UNIX style but 
actually is Windows style.  Not the same thing.

The mbx driver has been kludged to work around the subtle differences, but 
the other drivers have not.

> (4) (This is more of an IMAP protocol question.) I glanced at the RFC for 
> IMAP. Is there the concept of views/search folders/dynamic filters? It seems 
> that the 'mailbox' concept is like a folder, in that a message can only 
> belong to one. The closest thing I could find was the attribute, but it was 
> intended for things like 'read', etc.; can this be used for the above 
> purpose, or is IMAP not a good protocol to use for searching?

I don't understand this question.  Please rephrase it, and avoid the use 
of the word "folder" which has imprecise meaning.  Use the term "mailbox" 
(a name that holds messages), "directory" (a name that holds other names), 
or "dual-use name" (a name that is both a mailbox and a directory).

> - the 'root' user doesn't exist on my system (had to use SYSTEM)

Note that the UNIX version of UW imapd must be run as root and must be 
able to do a setuid to the target user.  This, of course, has no meaning 
under Cygwin.  Cygwin has a kludgy thing called cygwin_logon_user() which 
jackets into the Windows impersonation functionality which is actually 
quite different.

Once again, the native Windows build knows about all of this, and does the 
right thing.

As the author of UW imapd, I strongly recommend against using Cygwin as a 
platform for running it.  Instead, you are best off running imapd on a 
real UNIX system.  If you must use Windows, you are better off using the 
native build and dealing with the necessary customizations for your 
system, rather than hoping that Cygwin will do the right things for you.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

---

From: overbored <[email-masked]>
Date: Thu, 07 Oct 2004 00:46:33 -0700

It's basically a different way of organizing email, different from the 
concept of folders (mailboxes/directories).

Let's say I sort all my mail from a mailing list to one folder, and all 
my mail from friends to another. If I get a message from my friend sent 
to both me and the folder, I would like for it to show up in both folders.

I believe this is the main idea behind "search folders." All your mail 
is actually just in one place (one mailbox) but you can have multiple 
views over this (and preferrably the views are arranged hierarchically, 
instead of a flat list, so I could have the views 'Friends' and 
'Friends/Joe'). In other words, they're like instant search filters.

I realize that this is probably implemented in clients (just a matter of 
building/maintaining an index over the mail), but with multiple clients, 
you'd have to reproduce and synchronize the filters for each of them, 
and also the server wouldn't be filtering these for you as the mail 
comes in.

What I was mentioning were the attributes which I read about in the IMAP 
RFC. These were intended for things like 'Seen', 'Answered', 'Flagged', 
etc. What I'm wonder is if it's possible, efficient, or even a 
convention to use them for views ('Some mailing list', 'Friends/Joe', 
'Sent directly to me', etc,). Or perhaps there is a better way? Or no 
way at all?

>> for IMAP. Is there the concept of views/search folders/dynamic 
>> filters? It seems that the 'mailbox' concept is like a folder, in that 
>> a message can only belong to one. The closest thing I could find was 
>> the attribute, but it was intended for things like 'read', etc.; can 
>> this be used for the above purpose, or is IMAP not a good protocol to 
>> use for searching?
> 
> of the word "folder" which has imprecise meaning.  Use the term 
> "mailbox" (a name that holds messages), "directory" (a name that holds 
> other names), or "dual-use name" (a name that is both a mailbox and a 
> directory).

---

From: overbored <[email-masked]>
Date: Thu, 07 Oct 2004 01:21:15 -0700

Another idea (aside from attributes) is that maybe the server can make 
use of symbolic links to the email messages (at least for servers that 
use Maildirs).

Thus spake overbored on 10/7/2004 12:46 AM:
>>> filters? It seems that the 'mailbox' concept is like a folder, in 
>>> that a message can only belong to one. The closest thing I could find 
>>> was the attribute, but it was intended for things like 'read', etc.; 
>>> can this be used for the above purpose, or is IMAP not a good 
>>> protocol to use for searching?
>>
>>
>> I don't understand this question.  Please rephrase it, and avoid the 
>> use of the word "folder" which has imprecise meaning.  Use the term

---

From: Mark Crispin <[email-masked]>
Date: Thu, 7 Oct 2004 10:42:19 -0700 (Pacific Daylight Time)

On Thu, 7 Oct 2004, overbored wrote:
> Let's say I sort all my mail from a mailing list to one folder, and all my 
> mail from friends to another. If I get a message from my friend sent to both 
> me and the folder, I would like for it to show up in both folders.

Instead of using separate mailboxes (there is no such thing as "folder" in 
IMAP), perhaps you may want to use IMAP keywords?

-- Mark --

---

From: overbored <[email-masked]>
Date: Thu, 07 Oct 2004 16:44:37 -0700

Ah, I believe that's exactly what I'm looking for. Now I'm wondering 
what clients support IMAP keywords (the only one I currently know of is 
Pine).

Also, for those that don't support it (AFAIK, this includes mutt and 
TBird), are there any workarounds (e.g., making these collections of 
keywords appear to the client as a collection of traditional folders)?

Lastly, is there a standardized naming scheme for IMAP keywords? In 
particular, I'm wondering how hierarchies of keywords are represented 
(e.g., "/Friends/" and "/Friends/Joe Schmoe/")? And can these have 
keyword strings contain spaces in them?

Thus spake Mark Crispin on 10/7/2004 10:42 AM:
>> Let's say I sort all my mail from a mailing list to one folder, and 
>> all my mail from friends to another. If I get a message from my friend 
>> sent to both me and the folder, I would like for it to show up in both 
>> folders.
> 
> 
> Instead of using separate mailboxes (there is no such thing as "folder" 
> in IMAP), perhaps you may want to use IMAP keywords?
> 
> -- Mark --
>