Re: maildir and IMAP hell

Replies:

  • None.

Parents:

On Wed, Dec 24, 2003, Olivier Thereaux wrote:
> More to come, maybe, as I proceed with exploring courier.

I finally made my system work with courier... *Not* thanks to the doc,
which is apparently quite scattered, incomplete, and in my case
unhelpful.

What I learned with a lot of trial-and-error:

- The maildirs MUST be in ~/Maildir
If the directory does not exist, courier fails the authentication (now
*that* is a useful error message, thank you!)

- ~/Maildir MUST have the maildir format (i.e "cur tmp new" subfolders)
otherwise it stops silently and does not look for other sub-maildirs

- sub-maildirs must follow a specific naming convention (see below)

- While other implementations of maildir actually allow the directories
 to be embedded, courier only accept a flat list, and has its own way
of creating a virtual tree.

e.g... I have maildirs as follows:

~/Maildir
\
 maildir 1  
 foobar subdirectory
  \
    maildir 2
    maildir 3
 maildir 4


etc.

courier only accept a flat list as follows:

~/Maildir
\
 .maildir1
 .foobar.maildir2
 .foobar.maildir3
 .maildir4

the "dots" as separators for the hierarchy are mandatory, as far as I
can tell.


This did not really fit with my current mail structure, where maildirs
are in ~/mail, and deeply embedded

So I created ~/Maildir and the proper subdirectories ('mkdir cur tmp
new') and wrote a small perl script (I'm too lame to make it with shell,
but I'm certain it takes a simple one-liner) to symlink the existing
~/mail/foo/bar/quz to the appropriate ~/Maildir/.foo.bar.quz

copied here for your convenience, just in case:
[[
#!/usr/bin/perl -w


my $mdirname;
my $mdirsymlink;
open (MDIRS, "find ~/mail -name new |");
while (my $mdirname = <MDIRS>)
{
$mdirname =~ s/\n//;
$mdirsymlink = $mdirname;
$mdirname =~ s/\/new//;
$mdirsymlink =~ s/\/home\/ot\/mail//;
$mdirsymlink =~ s/\/new//;
$mdirsymlink =~ s/\//./g;
print "~/Maildir/$mdirsymlink";

if (-e "~/Maildir/$mdirsymlink")
{ print " already exists \n" }
else
{ `ln -s $mdirname ~/Maildir/$mdirsymlink`;
print " alias created \n";}
}
]]


The result is fast (quite obviously, since the imap server does not have
to read through the directory tree, only the flat list of maildirs)...
Which makes me think that courier is a good server, well documented with
regards to its installation, so it's a great candidate for a new server
welcoming new users, but its lack of good documentation doesn't make it
a very good candidate for e.g transition from a POP server, or another
implementation of maildirs over IMAP.

--
olivier

HURL: fogo mailing list archives, maintained by Gerald Oskoboiny