Localized Gmail IMAP Folders
Asked Answered
C

4

15

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.

Crunode answered 2/2, 2010 at 15:53 Comment(2)
It's even better, sometimes the [Gmail] folder is called [Google Mail] instead.Eyebright
we are running into the same issue. is there is complete list of localized folder names used in Gmail?Townswoman
M
14

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/

Marigolde answered 8/7, 2010 at 7:41 Comment(9)
They're currently in the process of formalizing this as the SPECIAL-USE extension to IMAP. See tools.ietf.org/html/draft-ietf-morg-list-specialuse-06Dilate
Does anyone know whether Javamail supports XLIST?Komsomol
JavaMail (v1.4.5) does not support XLIST. But you can use this JavaMail extension: java-gmail-imapPapyrology
Note that XLIST is currently deprecated. Use Special-Use Extension of LIST instead.Skindeep
@PetrPudlák The problem is that Gmail's special-use capability implementation is broken: limilabs.com/blog/gmail-special-use-capability-is-brokenMarigolde
@PawelLesnikowski I know this is a late response, but it seems there's a workaround for this. The Gmail IMAP documentation says their features are indicated by the presence of the X-GM-EXT-1 capability.Dulcine
@AndreiZisu X-GM-EXT-1 is used by gmail for years, it can not be used as an indicator that SPECIAL USE is available.Marigolde
Why not? It seems reasonable to meDulcine
Because it has nothing to with SPECIAL USE and was returned by Gmail IMAP server years ago when SPECIAL USE was not available. RFC is clear: "Supporting implementations MUST include the "SPECIAL-USE" capability string in response to an IMAP CAPABILITY command.". Assuming X-GM-EXT-1 is SPECIAL-USE is wrong.Marigolde
E
6

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, Κάδος απορριμμάτων, Корзина, ゴミ箱, 垃圾桶, 已删除邮件, 휴지통
Eyebright answered 2/2, 2010 at 16:10 Comment(1)
there is another list for [GMAIL]\All Mail at: sebsauvage.net/wiki/doku.php?id=gmail_archiverTownswoman
O
5

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-"',
Octahedral answered 5/1, 2014 at 13:38 Comment(1)
On preview, this seems to be the correct answer, and worked for me. Thank you!Rah
C
0

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.

Champlin answered 30/12, 2010 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.