Gmail’s SPECIAL-USE capability is broken

Recently it came to my attention that Gmail’s XLIST command is deprecated.

XLIST is a custom Gmail command that retrieves information about the folder purpose, without the need of knowing the folders name. It works by returning additional flags, such as \Spam, for folders of a known purpose (e.g. “[Gmail]/Spam”)

More standardized feature, deigned for the same purpose, is SPECIAL-USE extension.

Both XLIST and SPECIAL-USE are supported by Mail.dll. You can use CommonFolders class to get folder by its function.

On this site Gmail claims that:

Gmail supports the IMAP LIST Extension for Special-Use Mailboxes [RFC 6154], which provides new attributes for special folders.

And in the next paragraph:

The Gmail-specific XLIST command is deprecated in favor of the IMAP Special-Use List Standard [RFC 6154].

The problem is that their Special-Use support is seriously broken.

Broken CAPABILITY response

RFC 6154 clearly states:

Supporting implementations MUST include the “SPECIAL-USE” capability string in response to an IMAP CAPABILITY command.

Here’s the Gmail’s response to CAPABILITY command:

Initial:

S: * OK Gimap ready for requests from 89.67.10.122 z2if15323304eeo.17
C: f3a21e43c6c648e8 CAPABILITY
S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2

After logging in:

 C: 77776ad235694614 CAPABILITY
 S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE
 S: 77776ad235694614 OK Success

There is no “SPECIAL-USE” capability returned. What is funny deprecated XLIST is still there.

Broken LIST response

RFC 6154 clearly states:

If the client specifies the “SPECIAL-USE” return option, the LIST command MUST return the new special-use attributes on those mailboxes that have them set.

Gmail server fails to parse such command:

C: 7ab9a06868fa4717 LIST "" * RETURN (SPECIAL-USE)
S: 7ab9a06868fa4717 BAD Could not parse command

Correct LIST response?

It seems however that regular LIST response contains flags defined in RFC 6154 (\All, \Flagged, \Junk and so on):

* LIST (\HasNoChildren) "/" "INBOX"
S: * LIST (\Noselect \HasChildren) "/" "[Gmail]"
S: * LIST (\HasChildren \HasNoChildren \All) "/" "[Gmail]/All Mail"
S: * LIST (\HasNoChildren \Drafts) "/" "[Gmail]/Drafts"
S: * LIST (\HasChildren \HasNoChildren \Important) "/" "[Gmail]/Important"
S: * LIST (\HasChildren \HasNoChildren \Sent) "/" "[Gmail]/Sent Mail"
S: * LIST (\HasChildren \HasNoChildren \Junk) "/" "[Gmail]/Spam"
S: * LIST (\HasChildren \HasNoChildren \Flagged) "/" "[Gmail]/Starred"
S: * LIST (\HasChildren \HasNoChildren \Trash) "/" "[Gmail]/Trash"

The response follows the Special-Use standard with an additional \Important attribute added for Gmail’s Priority Inbox

Why not X-Important?

Tags:   

Questions?

Consider using our Q&A forum for asking questions.

2 Responses to “Gmail’s SPECIAL-USE capability is broken”

  1. MrEricsir Says:

    I just ran into the same issue. I wonder if Google accientally pushed up a documentation update before they were ready?

  2. Limilabs support Says:

    @MrEricsir,

    It seems so, although additional flags are shown in regular LIST response.
    Still, nothing bad happened as this should not break any client,
    old XLIST is still supported and new SPECIAL-USE is not advertised yet.