Skip to content

Add IMAP4.login_plain to imaplib #89869

Closed

Description

@przemub
mannequin
BPO 45706
Nosy @warsaw, @bitdancer, @przemub
PRs
  • bpo-45706: Add imaplib.IMAP4.login_plain #29398
  • Files
  • 0107-Add-imaplib.IMAP4.login_plain.patch: Patch
  • 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 2021-11-04.00:29:59.785>
    labels = ['type-feature', 'library', 'expert-email']
    title = 'Add IMAP4.login_plain to imaplib'
    updated_at = <Date 2021-11-04.00:44:53.945>
    user = 'https://github.com/przemub'

    bugs.python.org fields:

    activity = <Date 2021-11-04.00:44:53.945>
    actor = 'przemub'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'email']
    creation = <Date 2021-11-04.00:29:59.785>
    creator = 'przemub'
    dependencies = []
    files = ['50424']
    hgrepos = []
    issue_num = 45706
    keywords = ['patch']
    message_count = 1.0
    messages = ['405659']
    nosy_count = 3.0
    nosy_names = ['barry', 'r.david.murray', 'przemub']
    pr_nums = ['29398']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue45706'
    versions = []

    Activity

    1. przemub commented on Nov 4, 2021

      przemubmannequin
      MannequinAuthor

      Hi everyone and nice to meet you!

      I would like to propose adding a method login_plain to Python IMAP4 standard library client.

      Currently, one can use login, login_cram_md5 or add their own authentication method using authenticate. While login works great for plain text authentication for English users, it does not support characters out of ASCII, causing errors for users with non-ASCII passwords.

      I personally hit that with radicale-imap. It has been reported in bpo-34577, and its SMTP counterpart in bpo-29750.

      RFC6855 recommends using AUTHENTICATE for such cases, and so this patch adds login_plain in a manner similar to login_cram_md5. Adding this to a standard library will improve the experience for non-English users not only when programming but also when using other programs written in Python. AUTHENTICATE PLAIN is on by default in Dovecot and most e-mail providers, like Gmail and Outlook, making it more common than, already supported, AUTHENTICATE CRAM-MD5.

      Since this is my first patch, let me know if I could change something up - I did my best to RTFM!

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Nov 4, 2021
    3. transferred this issue fromon Apr 10, 2022
    4. serhiy-storchaka commented on Jul 5, 2026

      @serhiy-storchaka
      Member

      Added imaplib.IMAP4.login_plain() in GH-29398, authenticating with the PLAIN SASL mechanism (RFC 4616). Thank you @przemub for the request and the implementation.

    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

      stdlibStandard 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