Search code examples
pythonimapnon-ascii-charactersimaplib

Python imaplib select mailbox folder including special characters


If I list my mailbox folder with conn.list() I get a list of mailbox folder names that do not include special (accented) characters. E.g. my real mailbox fodler is "gelöschte elemente" but conn.list() returns with "gelschte elemente". It would not be a problem, if conn.select() would work with it but it does not work neither with "gelöschte elemente" nor with "gelschte elemente". Can anybody help me how to select a mailbox folder that contais special (accented) characters with python imaplib (or maybe with other python package)?

Of course my script works perfectly with mailbox folders that contain only ASCII characters like "INBOX" or "INBOX.Sent"...

Thank you!


Solution

  • I found the solution here

    surround your folder name in double quotes

    if it contains any non ASCII characters or spaces...