Localized Gmail IMAP Folders

后端 未结 4 1368
天命终不由人
天命终不由人 2020-12-16 14:50

I\'m building a tool that analyzes Gmail specific folders (e.g. \'[Gmail]/All Mail\', \'[Gmail]/Spam\'). It seems that the names are localized with respect to the user loca

4条回答
  •  感动是毒
    2020-12-16 15:24

    UPDATE June 2016

    Bear in mind that XLIST in Gmail IMAP was deprecated in 2013 and will eventually be removed.

    You will need to use the SPECIAL-USE mailboxes instead.

    Unfortunately, Gmail doesn't advertise this capability as per the spec, but it is implemented and works correctly (tested on 09/09/2016) - note the \Trash flag:

    C: 55535a988a074191 LIST "" * RETURN (SPECIAL-USE)
    S: ...
    S: * LIST (\HasNoChildren \Trash) "/" "[Gmail]/Bin"
    

    Regular LIST returns the same response as well (I'd say this is Gmail's bug).


    Original Answer

    There is a better way: XLIST command.

    Google and Apple developed a special IMAP command XLIST to address this issue.

    IMAP XLIST command returns a list of folders and their well-know flags (\Inbox, \Drafts, \Trash, \Sent, \Spam):

    * XLIST (\HasNoChildren \Inbox) "/" "Inbox"
    

    Mail.dll IMAP client (Commercial product I've created) supports XLIST command. It is used automatically when server advertises support for this feature. You can read more here: https://www.limilabs.com/blog/localized-gmail-imap-folders/

提交回复
热议问题