mailing list archives

meli community discussions

⚠️ if something does not work as intended when interracting with the mailing lists,
reach out Github mirror Gitea repo @epilys:matrix.org

E-mail headers
From: Mark Crispin <mrc+imap@panda.com>
To: imap-protocol@u.washington.edu
Date: Fri, 08 Jun 2018 12:34:43 -0000
Message-ID: alpine.OSX.2.00.1005190859110.29651@hsinghsing.panda.com permalink / raw / eml / mbox
In-Reply-To: 201005191535.o4JFZP5Q013449@mxout14.cac.washington.edu
References: 201005191535.o4JFZP5Q013449@mxout14.cac.washington.edu
On Wed, 19 May 2010, Pete Maclean wrote:
> I am adding support for namespaces to my IMAP server and have some
> questions about how the LIST command should work with them.

It's a difficult topic.  The best way to understand it is that there may
be multiple independent mail stores, of which only one are the "user's
mailboxes".  Consider, for example, an IMAP server that exports netnews
groups.

An analog that you might understand are drive letters in Windows.  It's
not completely the same, but some of the semantics are similar enough that
the IMAP rules may make sense if you keep those in mind.

> My main difficulty stems from the fact that LIST is described
> as returning "names" and I am unclear as to just what a "name" can be.

This refers to a name in the hierarchy, some or all of which are
mailboxes.  There may also be hierarchical names that are mere
directories; that contain other names but are not a mailbox themselves.
Consider that in netnews "comp.mail.imap" is a mailbox but "comp" and
"comp.mail" are not.

> Is it correct that the command:
>
> 1 LIST "" *
>
> should list mailboxes in all namespaces?

NO!!!

This command lists the mailboxes in the default namespace, which in most
implementations is the user's private set of mailboxes.

> Should it include namespace prefixes by
> themselves?

NO!!!  That completely obliviates the purpose and use of namespaces.

> What about:
>
> 1 LIST "" %
>
> My guess is that this should list top-level mailboxes in the default
> namespace

Yes.

> and the prefixes of other namespaces.

NO!!!

> (My notion of
> "default namespace" is simply the namespace that does not have a prefix.)

Correct.

> If I am correct about these first two commands then, as far as I can
> see, there is no way in a single LIST command to list only those
> mailboxes in the default namespace -- which seems unfortunate.  Is
> this the case?

No, it's not.  The LIST command lists mailboxes in one namespace.  If
there isn't a namespace somewhere in the reference or pattern argument,
then LIST will list only the default namespace.

> C: 4 NAMESPACE
> S: * NAMESPACE (("#Namespace1" "/")("#Namespace2" "/")("" "/")) NIL NIL
> S: 4 OK NAMESPACE completed

The response should be:

S: * NAMESPACE (("#Namespace1/" "/")("#Namespace2/" "/")("" "/")) NIL NIL

Otherwise, the only two mailboxes in those namespaces are #Namespace1 and
#Namespace2.

Worse, with this response, #Namespace1 is the default namespace (and thus
the only mailbox is #Namespace1).  So you probably wanted:

S: * NAMESPACE (("" "/"))("#Namespace1/" "/")("#Namespace2/" "/")  NIL NIL

> C: 6 LIST "" #Namespace1
> S: 6 OK LIST completed

So, #Namespace1 can only have one mailbox ("#Namespace1") because there's
no terminating hierarchy delimiter in the NAMESPACE result, but that name
doesn't exist.

Now, if the NAMESPACE result had "#Namespace1/", then you could have done

C: 6 LIST "" #Namespace1/*

and maybe you would see some names in there.

> For one thing, I am unsure as to whether my server's response to this
> LIST command should be as shown or like this:
>
> C: 6 LIST "" #Namespace1
> S: * LIST (\Noselect) "/" #Namespace1
> S: 6 OK LIST completed

Typically, a namespace is not a hierarchical name itself, but rather the
identifier for a hierarchy.  So usually, there is no \NoSelect response
for the namespace itself.  IMAP does not specifically forbid it though.

Now,

6 LIST "" #Namespace1/

is an entirely different matter, since the root of the namespace may be
something reasonable to list.

And, certainly

6 LIST "" #Namespace1/*

and

6 LIST "" #Namespace1/%

are quite reasonable and common.

-- Mark --

http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.
Reply