Search code examples
shellubuntugmailimap

Gmail imap can't access folders with space (or other escapted characters) in the title


Lets say i'm connection to imap.gmail.com via shell

>> openssl s_client -connect imap.gmail.com:993 -crlf
>> a1 login asdasd@gmail.com asdasdasdasd

Getting the list of the folders:

>> a1 list "" *

Respond:

....
* LIST (\HasChildren) "/" "github"
* LIST (\HasNoChildren) "/" "Wizz&AKA-Air"
....

Now lets try to select the mailbox:

This will work:

a1 select "github"

Respond:

* FLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotJunk $NotPhishing $Phishing)
* OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen $NotJunk $NotPhishing $Phishing \*)] Flags permitted.
* OK [UIDVALIDITY 639992816] UIDs valid.
* 4 EXISTS
* 0 RECENT
* OK [UIDNEXT 5] Predicted next UID.
* OK [HIGHESTMODSEQ 4768827]
a1 OK [READ-WRITE] github selected. (Success)

This will return error:

a1 select "Wizz&AKA-Air"

Respond:

a1 select "Wizz&AKA-Air"
a1 NO [NONEXISTENT] Unknown Mailbox: Wizz&AKA-Air (now in authenticated state) (Failure)

So, "&AKA-" is just escape for the white space, but I can't select the mailbox with the white space. Any ideas?


Solution

  • Folder "Wizz Air" was originally imported form mailbox on Yandex.com and that was the issue. The issue was solved after I renamed the tag and then renamed it back