Skip to content

imaplib.py "select" mailbox names containing spaces. #90378

Description

@mckenzm
mannequin
BPO 46220
Nosy @terryjreedy, @mckenzm

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2022-01-01.13:08:23.738>
labels = ['type-feature', 'library', '3.11']
title = 'imaplib.py "select" mailbox names containing spaces.'
updated_at = <Date 2022-01-07.18:50:27.423>
user = 'https://github.com/mckenzm'

bugs.python.org fields:

activity = <Date 2022-01-07.18:50:27.423>
actor = 'terry.reedy'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2022-01-01.13:08:23.738>
creator = 'mckenzm'
dependencies = []
files = []
hgrepos = []
issue_num = 46220
keywords = []
message_count = 2.0
messages = ['409457', '410000']
nosy_count = 2.0
nosy_names = ['terry.reedy', 'mckenzm']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue46220'
versions = ['Python 3.11']

Activity

  1. mckenzm commented on Jan 1, 2022

    mckenzmmannequin
    MannequinAuthor

    A mailbox (folder) need not be for a recipient and need not be the private part of an RFC2822 address.

    Passing a value of "000 Bookings" to select() results in validation issues when the tokens are parsed as arguments and there are too many.

    It would be a nice-to-have to accept spaces in the name.

    Workaround is for a rule to be applied by a desktop email client such as Evolution to move it from the INBOX upon discovery according to filter criteria.

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    type-featureA feature request or enhancement
    on Jan 1, 2022
  3. terryjreedy commented on Jan 7, 2022

    @terryjreedy
    Member

    I presume you mean the mailbox parameter of imaplib.IMAP.select().
    https://docs.python.org/3/library/imaplib.html#imaplib.IMAP4.select

    IMAP4.select(mailbox='INBOX', readonly=False)
    Select a mailbox. Returned data is the count of messages in mailbox (EXISTS response). The default mailbox is 'INBOX'. If the readonly flag is set, modifications to the mailbox are not allowed.
    

    Enhancements only go into future releases. Please make sure that the current main branch does not have the feature you are requesting.

    Neither our doc nor https://datatracker.ietf.org/doc/html/rfc2060.html contain '2822', so you might be requesting something not supported.

    There is no active maintainer for this module, so response from someone familiar with imaplib may take awhile.

  4. transferred this issue fromon Apr 10, 2022
  5. vadmium commented on Apr 20, 2024

    @vadmium
    Member

    In general I believe select(mailbox) expects the argument to use the IMAP protocol astring syntax. Perhaps adding an encode_astring function would help?

  6. serhiy-storchaka commented on Jul 5, 2026

    @serhiy-storchaka
    Member

    Mailbox names containing spaces are now quoted automatically since GH-152703. Closing as a duplicate of gh-40038.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-emailtype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions