{"id":4622,"date":"2014-06-06T07:46:00","date_gmt":"2014-06-06T05:46:00","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=4622"},"modified":"2014-06-13T16:14:37","modified_gmt":"2014-06-13T14:14:37","slug":"gmail-doesnt-send-ok-unseen-n-when-required","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/gmail-doesnt-send-ok-unseen-n-when-required","title":{"rendered":"Gmail doesn&#8217;t send &#8220;OK [UNSEEN n]&#8221; when required"},"content":{"rendered":"<p>In IMAP protocol <code>OK [UNSEEN &lt;n&gt;]<\/code> is a required untagged response to SELECT command. Core IMAP specification (<a href=\"\/mail\/rfc\/3501\">RFC 3501<\/a>) along with the <a href=\"http:\/\/www.rfc-editor.org\/errata_search.php?rfc=3501\">errata<\/a> states:<\/p>\n<blockquote><p>\nResponses:  REQUIRED untagged responses: FLAGS, EXISTS, RECENT<br \/>\nREQUIRED OK untagged responses:  PERMANENTFLAGS,<br \/>\nUIDNEXT, UIDVALIDITY, <strong>UNSEEN (if any unseen exist)<\/strong>\n<\/p><\/blockquote>\n<p>and later:<\/p>\n<blockquote><p>\nIf there are any unseen messages in the mailbox, an<strong> UNSEEN response MUST be sent<\/strong>, if not it MUST be omitted.\n<\/p><\/blockquote>\n<p>However Gmail IMAP server doesn&#8217;t send the <code>OK [UNSEEN &lt;n&gt;]<\/code> response, even when there are unseen emails in the mailbox. The following listing shows that (note the subsequent SEARCH command that returns a single email):<br \/>\n<code><br \/>\nC: c7a56 SELECT \"INBOX\"<br \/>\nS: * FLAGS (\\Answered \\Flagged \\Draft \\Deleted \\Seen $Phishing $MDNSent NonJunk $NotPhishing Junk)<br \/>\nS: * OK [PERMANENTFLAGS (\\Answered \\Flagged \\Draft \\Deleted \\Seen $Phishing $MDNSent NonJunk $NotPhishing Junk \\*)] Flags permitted.<br \/>\nS: * OK [UIDVALIDITY 3] UIDs valid.<br \/>\nS: * 7619 EXISTS<br \/>\nS: * 0 RECENT<br \/>\nS: * OK [UIDNEXT 30566] Predicted next UID.<br \/>\nS: * OK [HIGHESTMODSEQ 2384884]<br \/>\nS: c7a56 OK [READ-WRITE] INBOX selected. (Success)<br \/>\nC: a7c39 UID SEARCH UNSEEN<br \/>\nS: * SEARCH 30565<br \/>\nS: a7c39 OK SEARCH completed (Success)<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In IMAP protocol OK [UNSEEN &lt;n&gt;] is a required untagged response to SELECT command. Core IMAP specification (RFC 3501) along with the errata states: Responses: REQUIRED untagged responses: FLAGS, EXISTS, RECENT REQUIRED OK untagged responses: PERMANENTFLAGS, UIDNEXT, UIDVALIDITY, UNSEEN (if any unseen exist) and later: If there are any unseen messages in the mailbox, an [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[98,25,28],"class_list":["post-4622","post","type-post","status-publish","format-standard","hentry","category-news","tag-bug","tag-gmail","tag-imap"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4622"}],"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=4622"}],"version-history":[{"count":14,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4622\/revisions"}],"predecessor-version":[{"id":4691,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4622\/revisions\/4691"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=4622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=4622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=4622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}