本地化的Gmail IMAP文件夹 [英] Localized Gmail IMAP Folders

查看:132
本文介绍了本地化的Gmail IMAP文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个分析Gmail特定文件夹的工具(例如'[Gmail] /所有邮件','[Gmail] /垃圾邮件')。看起来这些名称已根据用户本地化设置进行了本地化,因此,例如,[Gmail] / All Mail'显示为'[Gmail] / Todos'给西班牙用户。



gmail文件夹是否有非本地化的规范名称?一种方法来检测它?或者在最糟糕的情况下,列出可能的本地化名称。

/ p>

请注意,Gmail IMAP中的 XLIST 在2013年不推荐使用,并最终被删除。

您需要使用 SPECIAL-USE信箱取而代之。

不幸的是,Gmail并未根据规范宣传此功能,但它已实施并正常工作(在09年9月9日测试过) - 请注意\垃圾标志:

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

常规LIST也会返回相同的响应(我会说这是Gmail的bug)。 strong> Original Answer



有更好的方法: XLIST 命令。

Google和Apple开发了一个特殊的IMAP命令XLIST来解决此问题。



IMAP XLIST命令返回文件夹列表及其众所周知的标志(\Inbox,\Drafts,\Trash,\ Sent,\ Spam):

  * XLIST(\HasNoChildren \Inbox)/收件箱

Mail.dll IMAP客户端(我创建的商业产品)支持XLIST命令。它在服务器宣传支持此功能时自动使用。您可以在这里阅读更多信息: https://www.limilabs.com/blog/ localized-gmail-imap-folders /


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 localization settings, so '[Gmail]/All Mail' show as '[Gmail]/Todos' to Spanish users for example.

Is there a non-localized canonical name for gmail folders? A way to detect it? Or in worst case scenario, a list of the possible localized names.

解决方案

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/

这篇关于本地化的Gmail IMAP文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆