{"id":3826,"date":"2013-03-25T12:46:13","date_gmt":"2013-03-25T10:46:13","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=3826"},"modified":"2015-07-30T16:12:53","modified_gmt":"2015-07-30T14:12:53","slug":"gmail-special-use-capability-is-broken","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/gmail-special-use-capability-is-broken","title":{"rendered":"Gmail&#8217;s SPECIAL-USE capability is broken"},"content":{"rendered":"<p>Recently it came to my attention that Gmail&#8217;s <a href=\"https:\/\/developers.google.com\/google-apps\/gmail\/imap_extensions\" rel=\"nofollow\">XLIST command is deprecated<\/a>.<\/p>\n<p><a href=\"\/blog\/localized-gmail-imap-folders\">XLIST is a custom Gmail command<\/a> 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. &#8220;[Gmail]\/Spam&#8221;)<\/p>\n<p>More standardized feature, deigned for the same purpose, is SPECIAL-USE extension.<\/p>\n<p>Both <a href=\"\/blog\/common-imap-folders\">XLIST and SPECIAL-USE<\/a> are supported by Mail.dll. You can use <em>CommonFolders<\/em> class to get folder by its function.<\/p>\n<p>On this site Gmail claims that:<\/p>\n<blockquote><p>Gmail <strong>supports <\/strong>the <a href=\"\/mail\/rfc\/6154\">IMAP LIST Extension for Special-Use Mailboxes [RFC 6154]<\/a>, which provides new attributes for special folders.<\/p><\/blockquote>\n<p>And in the next paragraph: <\/p>\n<blockquote><p>The Gmail-specific XLIST command is <strong>deprecated <\/strong>in favor of the <a href=\"\/mail\/rfc\/6154\">IMAP Special-Use List Standard [RFC 6154]<\/a>. <\/p><\/blockquote>\n<p>The problem is that their Special-Use support is seriously broken.<\/p>\n<h2>Broken CAPABILITY response<\/h2>\n<p>RFC 6154 clearly states:<\/p>\n<blockquote><p>Supporting implementations <strong>MUST <\/strong>include the &#8220;SPECIAL-USE&#8221; capability string in response to an IMAP CAPABILITY command.<\/p><\/blockquote>\n<p>Here&#8217;s the Gmail&#8217;s response to CAPABILITY  command:<\/p>\n<p>Initial:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nS: * OK Gimap ready for requests from 89.67.10.122 z2if15323304eeo.17\r\nC: f3a21e43c6c648e8 CAPABILITY\r\nS: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2\r\n<\/pre>\n<p>After logging in:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n C: 77776ad235694614 CAPABILITY\r\n S: * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE\r\n S: 77776ad235694614 OK Success\r\n<\/pre>\n<p>There is no &#8220;SPECIAL-USE&#8221; capability returned. What is funny deprecated XLIST is still there.<\/p>\n<h2>Broken LIST response<\/h2>\n<p>RFC 6154 clearly states:<\/p>\n<blockquote><p>If the client specifies the &#8220;SPECIAL-USE&#8221; return option, the LIST command <strong>MUST <\/strong>return the new special-use attributes on those mailboxes that have them set.\n<\/p><\/blockquote>\n<p>Gmail server fails to parse such command:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nC: 7ab9a06868fa4717 LIST &quot;&quot; * RETURN (SPECIAL-USE)\r\nS: 7ab9a06868fa4717 BAD Could not parse command\r\n<\/pre>\n<h2>Correct LIST response?<\/h2>\n<p>It seems however that regular LIST response contains flags defined in <a href=\"\/mail\/rfc\/6154\">RFC 6154<\/a> (\\All, \\Flagged, \\Junk and so on):<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n* LIST (\\HasNoChildren) &quot;\/&quot; &quot;INBOX&quot;\r\nS: * LIST (\\Noselect \\HasChildren) &quot;\/&quot; &quot;&#x5B;Gmail]&quot;\r\nS: * LIST (\\HasChildren \\HasNoChildren \\All) &quot;\/&quot; &quot;&#x5B;Gmail]\/All Mail&quot;\r\nS: * LIST (\\HasNoChildren \\Drafts) &quot;\/&quot; &quot;&#x5B;Gmail]\/Drafts&quot;\r\nS: * LIST (\\HasChildren \\HasNoChildren \\Important) &quot;\/&quot; &quot;&#x5B;Gmail]\/Important&quot;\r\nS: * LIST (\\HasChildren \\HasNoChildren \\Sent) &quot;\/&quot; &quot;&#x5B;Gmail]\/Sent Mail&quot;\r\nS: * LIST (\\HasChildren \\HasNoChildren \\Junk) &quot;\/&quot; &quot;&#x5B;Gmail]\/Spam&quot;\r\nS: * LIST (\\HasChildren \\HasNoChildren \\Flagged) &quot;\/&quot; &quot;&#x5B;Gmail]\/Starred&quot;\r\nS: * LIST (\\HasChildren \\HasNoChildren \\Trash) &quot;\/&quot; &quot;&#x5B;Gmail]\/Trash&quot;\r\n<\/pre>\n<blockquote><p>The response follows the Special-Use standard with an additional \\Important attribute added for Gmail&#8217;s Priority Inbox<\/p><\/blockquote>\n<p>Why not X-Important?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently it came to my attention that Gmail&#8217;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. &#8220;[Gmail]\/Spam&#8221;) More standardized feature, deigned for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[98,25,28],"class_list":["post-3826","post","type-post","status-publish","format-standard","hentry","category-mail-dll","tag-bug","tag-gmail","tag-imap"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3826"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=3826"}],"version-history":[{"count":22,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3826\/revisions"}],"predecessor-version":[{"id":4956,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/3826\/revisions\/4956"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=3826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=3826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=3826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}