[New-bugs-announce] [issue13940] imaplib: Mailbox names are not quoted

Johannes Bauer report at bugs.python.org
Sat Feb 4 13:04:58 CET 2012

New submission from Johannes Bauer <dfnsonfsduifb at gmx.de>:

imaplib does not qupote mailbox names when it's sending it's query to the server in response to a status request, for example. This will lead to very strange errors if mailboxes are accessed which contain spaces:


connection.status("mailbox name", "(MESSAGES)")

will return

  File "/home/joe/test/imaplib.py", line 920, in _command_complete
    raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: STATUS command error: BAD [b'Error in IMAP command STATUS: Status items must be list.']

which indicates that the error is within the actual flag list. It is not, however:

connection.status("\"mailbox name\"", "(MESSAGES)")

works as expected. This may arguably be or not be a bug -- however it is REALLY confusing to the user. Maybe at least a note should be included somewhere that -- just to be safe -- mailbox names should be quoted.

All the best,

components: Library (Lib)
messages: 152612
nosy: joebauer
priority: normal
severity: normal
status: open
title: imaplib: Mailbox names are not quoted
type: behavior
versions: Python 3.1

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list