Feature or enhancement
Proposal:
Feature request
The imaplib module currently provides support for IMAP4rev1, but does not provide first-class support for IMAP4rev2 as specified by RFC 9051.
It would be useful to add IMAP4rev2 support to imaplib, allowing Python applications to explicitly negotiate and use IMAP4rev2 when supported by an IMAP server.
Motivation
IMAP4rev2 has been standardized in RFC 9051 and modern IMAP servers may advertise IMAP4rev2 in their CAPABILITY response.
Currently, applications using imaplib cannot cleanly express that they require or prefer IMAP4rev2, nor does imaplib expose an API specifically designed around the IMAP4rev2 protocol version.
Supporting IMAP4rev2 would allow Python's standard library to keep pace with the current version of the IMAP protocol while maintaining backwards compatibility with existing IMAP4rev1 servers.
Proposed implementation
Add IMAP4rev2 support to imaplib, while preserving the existing IMAP4rev1 API and behavior.
In particular:
- Detect
IMAP4rev2 in the server's CAPABILITY response.
- Provide a way for clients to determine which IMAP protocol version has been negotiated.
- Allow clients to explicitly prefer or request IMAP4rev2 where appropriate.
- Implement the protocol changes required by RFC 9051.
- Preserve compatibility with servers that only support IMAP4rev1.
- Update the
imaplib documentation to describe IMAP4rev2 support and version negotiation.
- Add comprehensive tests covering IMAP4rev2 capability detection and protocol behavior.
The implementation should follow RFC 9051 and, where applicable, the related IMAP extensions referenced by that RFC.
References
- RFC 9051 — Internet Message Access Protocol (IMAP) — Version 4rev2
- RFC 3501 — Internet Message Access Protocol — Version 4rev1
- CPython
imaplib implementation: Lib/imaplib.py
Additional considerations
The implementation should take into account that IMAP4rev2 incorporates and changes functionality compared with IMAP4rev1. Therefore, this should not be limited to merely recognizing the IMAP4rev2 capability token.
In particular, the implementation should identify the protocol-level differences between RFC 3501 and RFC 9051 and ensure that imaplib behaves correctly when communicating with an IMAP4rev2 server.
This issue is intended to track adding proper IMAP4rev2 support to the Python standard library while keeping existing IMAP4rev1 applications functional.
Feature or enhancement
Proposal:
Feature request
The
imaplibmodule currently provides support for IMAP4rev1, but does not provide first-class support for IMAP4rev2 as specified by RFC 9051.It would be useful to add IMAP4rev2 support to
imaplib, allowing Python applications to explicitly negotiate and use IMAP4rev2 when supported by an IMAP server.Motivation
IMAP4rev2 has been standardized in RFC 9051 and modern IMAP servers may advertise
IMAP4rev2in theirCAPABILITYresponse.Currently, applications using
imaplibcannot cleanly express that they require or prefer IMAP4rev2, nor doesimaplibexpose an API specifically designed around the IMAP4rev2 protocol version.Supporting IMAP4rev2 would allow Python's standard library to keep pace with the current version of the IMAP protocol while maintaining backwards compatibility with existing IMAP4rev1 servers.
Proposed implementation
Add IMAP4rev2 support to
imaplib, while preserving the existing IMAP4rev1 API and behavior.In particular:
IMAP4rev2in the server'sCAPABILITYresponse.imaplibdocumentation to describe IMAP4rev2 support and version negotiation.The implementation should follow RFC 9051 and, where applicable, the related IMAP extensions referenced by that RFC.
References
imaplibimplementation:Lib/imaplib.pyAdditional considerations
The implementation should take into account that IMAP4rev2 incorporates and changes functionality compared with IMAP4rev1. Therefore, this should not be limited to merely recognizing the
IMAP4rev2capability token.In particular, the implementation should identify the protocol-level differences between RFC 3501 and RFC 9051 and ensure that
imaplibbehaves correctly when communicating with an IMAP4rev2 server.This issue is intended to track adding proper IMAP4rev2 support to the Python standard library while keeping existing IMAP4rev1 applications functional.