本地化的 Gmail IMAP 文件夹

发布于 2024-08-20 04:07:01 字数 195 浏览 21 评论 0原文

我正在构建一个分析 Gmail 特定文件夹的工具(例如“[Gmail]/所有邮件”、“[Gmail]/垃圾邮件”)。这些名称似乎是根据用户本地化设置进行本地化的,因此,例如,“[Gmail]/所有邮件”对西班牙用户显示为“[Gmail]/Todos”。

Gmail 文件夹是否有非本地化的规范名称?有办法检测到吗?或者在最坏的情况下,可能的本地化名称的列表。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

老旧海报 2024-08-27 04:07:01

2016 年 6 月更新

请记住,Gmail IMAP 中的 XLIST 已于 2013 年弃用,最终将被删除。

您将需要使用特殊用途邮箱

不幸的是,Gmail 没有按照规范宣传此功能,但它已实现并正常工作(于 09/09/2016 测试) - 请注意 \Trash 标志:

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

常规列表也返回相同的响应(我想说这是 Gmail 的错误)。


原始答案

有一个更好的方法:XLIST命令。

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

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

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

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

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/

有木有妳兜一样 2024-08-27 04:07:01

此用户脚本有一个非常不完整的列表,其中有很多问号:

  • Inbox、Indbakke、Posteingang、Recibidos , Bo?te de r?ception, Posta in arrivo, Postvak IN, Odebrane, Caixa de entrada,
  • Starred, Stjernemarkerede, Markiert, Destacados, Messages suivis, Speciali, Met ster, Oznaczone gwiazdka, Com estrela, ?????? ??????、
  • 聊天、Chatsamtaler、Tous les chats、聊天、Czaty、Bate-papo、?????、
  • 已发送邮件、发送电子邮件、Gesendet、Enviados、消息特使、Posta inviata、Verzonden berichten、Wyslane 、电子邮件 enviados、Correio enviado、????????????、
  • 草稿、Kladder、Entw?rfe、Borradores、Brouillons、Bozze、Concepten、Wersje robocze、Rascunhos、?????? ??、
  • 所有邮件、所有电子邮件、所有 Nachrichten、待办事项、所有消息、所有消息、所有邮件、Wszystkie、待办电子邮件、待办事项、??? ??????、
  • 垃圾邮件、Mensagens n?o solicitadas、??????、
  • 垃圾箱、Bin、Papirkurv、Papierkorb、Papelera、Corbeille、Cestino、Prullenbak、Kosz、Lixeira、Caixote do lixo、?????? ,

Android 的 电子邮件 repo 在 res/values-xx/strings.xml 下还有更多内容。它出现在 Google 搜索 Gmail 的一些字符串中,因此它有可能起作用。它们可能不一定与 Gmail 的字符串匹配,因此买者自负 - 例如,它没有“所有邮件”,因为它适用于通用电子邮件客户端。

  • 草稿 Borradores、Borradores、Bozze、Brouillons、Concepten、Entwürfe、Kladder、Koncepty、Kopie robocze、Rascunhos、Rascunhos、Taslaklar、Utkast、Utkast、Πρόχειρα、Черновики、下书き、草稿、草稿、임 시보관함
  • < Bandeja de entrada、Boîte de réception、Caixa de entrada、Caixa de entrada、Doručená pošta、Gelen Kutusu、Indbakke、Inkorgen、Innboks、Odebrane、Posta in arrivo、Posteingang、Postvak IN、Recibidos、Eισερχόμενα、 Входящие, 受信托雷伊, 收件箱, 收件箱, 받은편지함
  • 垃圾 Correio electrónico não solicitado, Correo basura, Junk, Junk, Lixo, Nettsøppel, Nevyžádaná pošta, No solicitado, Ongewenst, Posta indesiderata, Skräp、垃圾邮件、Wiadomości-śmieci、Önemsiz、Aνεπιθύμτα、Спам、垃圾邮件、垃圾邮件、迷惑メール、스팸
  • 发件箱 Bandeja de salida、Boîte d'envoi、Caixa de saída、Caixa de saída、Do wysłania, Enviados, Giden Kutusu, Posta in uscita, Postausgang, Postvak UIT, Pošta k odeslání, Udbakke, Utboks, Utkorgen, Εεερχόμενα, Исходящие, 发件箱, 寄件箱, 送信toreei, 보낼편지함
  • <强>已发送 电子邮件 enviados, Enviada, Enviado, Enviado, Gesendet, Gönderildi, Inviati, Odeslaná pošta, Sendt, Sendt, Skickat, Verzonden, Wysłane, Éléments envoyés, Απεσταλμένα, Отправленные, 寄件备份, 已发送邮件, 发送信済み, 보낸 편지함
  • 垃圾 Cestino、Corbeille、Kosz、Koš、Lixeira、Lixo、Papelera、Papelera、Papierkorb、Papirkurv、Papirkurv、Papperskorgen、Prullenbak、Çöp Kutusu、Κάδος απορριμμάτων、Корзина、ゴミ箱, 垃圾桶, 已删除邮件, 휴지통

This user script has a very incomplete list with lots of question marks:

  • Inbox, Indbakke, Posteingang, Recibidos, Bo?te de r?ception, Posta in arrivo, Postvak IN, Odebrane, Caixa de entrada,
  • Starred, Stjernemarkerede, Markiert, Destacados, Messages suivis, Speciali, Met ster, Oznaczone gwiazdka, Com estrela, ??????????,
  • Chats, Chatsamtaler, Tous les chats, Chat, Czaty, Bate-papo, ????,
  • Sent Mail, Sendte e-mails, Gesendet, Enviados, Messages envoy?s, Posta inviata, Verzonden berichten, Wyslane, E-mails enviados, Correio enviado, ????????????,
  • Drafts, Kladder, Entw?rfe, Borradores, Brouillons, Bozze, Concepten, Wersje robocze, Rascunhos, ?????????,
  • All Mail, Alle e-mails, Alle Nachrichten, Todos, Tous les messages, Tutti i messaggi, Alle berichten, Wszystkie, Todos os e-mails, Todo o correio, ??? ?????,
  • Spam, Mensagens n?o solicitadas, ????,
  • Trash, Bin, Papirkurv, Papierkorb, Papelera, Corbeille, Cestino, Prullenbak, Kosz, Lixeira, Caixote do lixo, ???????,

Android's Email repo has some more under res/values-xx/strings.xml. It turned up in a Google search for some of Gmail's strings, so there's a chance it will work. They might not necessarily match Gmail's strings, so caveat emptor — it doesn't have "All Mail", for example, since it's for the generic email client.

  • drafts Borradores, Borradores, Bozze, Brouillons, Concepten, Entwürfe, Kladder, Koncepty, Kopie robocze, Rascunhos, Rascunhos, Taslaklar, Utkast, Utkast, Πρόχειρα, Черновики, 下書き, 草稿, 草稿, 임시보관함
  • inbox Bandeja de entrada, Boîte de réception, Caixa de entrada, Caixa de entrada, Doručená pošta, Gelen Kutusu, Indbakke, Inkorgen, Innboks, Odebrane, Posta in arrivo, Posteingang, Postvak IN, Recibidos, Εισερχόμενα, Входящие, 受信トレイ, 收件匣, 收件箱, 받은편지함
  • junk Correio electrónico não solicitado, Correo basura, Junk, Junk, Lixo, Nettsøppel, Nevyžádaná pošta, No solicitado, Ongewenst, Posta indesiderata, Skräp, Spam, Wiadomości-śmieci, Önemsiz, Ανεπιθύμητα, Спам, 垃圾邮件, 垃圾郵件, 迷惑メール, 스팸
  • outbox Bandeja de salida, Boîte d'envoi, Caixa de saída, Caixa de saída, Do wysłania, Enviados, Giden Kutusu, Posta in uscita, Postausgang, Postvak UIT, Pošta k odeslání, Udbakke, Utboks, Utkorgen, Εξερχόμενα, Исходящие, 发件箱, 寄件匣, 送信トレイ, 보낼편지함
  • sent E-mails enviados, Enviada, Enviado, Enviado, Gesendet, Gönderildi, Inviati, Odeslaná pošta, Sendt, Sendt, Skickat, Verzonden, Wysłane, Éléments envoyés, Απεσταλμένα, Отправленные, 寄件備份, 已发送邮件, 送信済み, 보낸편지함
  • trash Cestino, Corbeille, Kosz, Koš, Lixeira, Lixo, Papelera, Papelera, Papierkorb, Papirkurv, Papirkurv, Papperskorgen, Prullenbak, Çöp Kutusu, Κάδος απορριμμάτων, Корзина, ゴミ箱, 垃圾桶, 已删除邮件, 휴지통
知足的幸福 2024-08-27 04:07:01

今天看到这个答案,发现 Gmail 中的 XLIST 现已弃用。当前的解决方案是特殊用途邮箱的 IMAP LIST 扩展,Gmail 支持该解决方案。

我的希伯来语邮箱的列表输出示例:

'(\\Noselect \\HasChildren) "/" "[Gmail]"',
'(\\HasNoChildren \\Trash) "/" "[Gmail]/&BdAF6QXkBdQ-"',
'(\\HasNoChildren \\Sent) "/" "[Gmail]/&BdMF1QXQBeg- &BdkF1QXmBdA-"',
'(\\HasNoChildren \\Important) "/" "[Gmail]/&BdcF6QXVBdE-"',
'(\\HasNoChildren \\Drafts) "/" "[Gmail]/&BdgF2QXVBdgF1QXq-"',
'(\\HasNoChildren \\All) "/" "[Gmail]/&BdsF3A- &BdQF0wXVBdAF6A-"',
'(\\HasNoChildren \\Flagged) "/" "[Gmail]/&Bd4F4QXVBd4F3w- &BdEF2wXVBdsF0Q-"',
'(\\HasNoChildren \\Junk) "/" "[Gmail]/&BeEF5AXQBd0-"',

Came into this answer today and found out that XLIST in Gmail is now deprecated. The current solution is IMAP LIST Extension for Special-Use Mailboxes, which is supported by Gmail.

Example LIST output from my Hebrew mailbox:

'(\\Noselect \\HasChildren) "/" "[Gmail]"',
'(\\HasNoChildren \\Trash) "/" "[Gmail]/&BdAF6QXkBdQ-"',
'(\\HasNoChildren \\Sent) "/" "[Gmail]/&BdMF1QXQBeg- &BdkF1QXmBdA-"',
'(\\HasNoChildren \\Important) "/" "[Gmail]/&BdcF6QXVBdE-"',
'(\\HasNoChildren \\Drafts) "/" "[Gmail]/&BdgF2QXVBdgF1QXq-"',
'(\\HasNoChildren \\All) "/" "[Gmail]/&BdsF3A- &BdQF0wXVBdAF6A-"',
'(\\HasNoChildren \\Flagged) "/" "[Gmail]/&Bd4F4QXVBd4F3w- &BdEF2wXVBdsF0Q-"',
'(\\HasNoChildren \\Junk) "/" "[Gmail]/&BeEF5AXQBd0-"',
客…行舟 2024-08-27 04:07:01

Cyrus IMAPd 在 2.4 版中也支持 XLIST 命令(使用相当狡猾的 hack),Thunderbird 客户端也是如此。

事实上,我正在扩展 Cyrus 以更灵活地支持 XLIST,因此您在配置文件中不需要硬编码的文件夹名称集。所需更改的复杂性意味着在我们升级到 2.5 版本之前它可能不会发布。

Cyrus IMAPd also supports XLIST command in version 2.4 (with a rather dodgy hack), as does the Thunderbird client.

In fact, I'm in the middle of extending Cyrus to support XLIST more flexibly, so you don't have a hard coded set of folder names in a config file. The complexity of the changes required means it probably won't be in a release until we bump to version 2.5 though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文