pydoc > imaplib

๐Ÿ“˜ NAME

imaplib - IMAP4 client.

๐Ÿš€ Quick Reference

Use CaseCommandDescription
๐Ÿ”— Connect to IMAP serverIMAP4(host, port)Instantiate an IMAP4 client object
๐Ÿ”‘ LoginM.login(user, password)Authenticate with plaintext password
๐Ÿ“‚ List mailboxesM.list(directory, pattern)List mailbox names matching pattern
๐Ÿ“ Select mailboxM.select(mailbox, readonly)Select a mailbox (default INBOX)
๐Ÿ” Search messagesM.search(charset, *criteria)Search for messages matching criteria
๐Ÿ“ฅ Fetch messagesM.fetch(message_set, parts)Fetch parts of messages
๐Ÿšช LogoutM.logout()Shutdown connection to server

๐Ÿ“š MODULE REFERENCE

https://docs.python.org/3.10/library/imaplib.html

The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.

๐Ÿ“– DESCRIPTION

Based on RFC 2060.

๐Ÿ“ฆ CLASSES

builtins.object
    IMAP4
        IMAP4_SSL
        IMAP4_stream

๐Ÿท๏ธ class IMAP4(builtins.object)

IMAP4(host='', port=143, timeout=None)

๐Ÿ“Œ IMAP4 client class.

Instantiate with: IMAP4([host[, port[, timeout=None]]])

All IMAP4rev1 commands are supported by methods of the same name (in lower-case).

Each command returns a tuple: (type, [data, ...]) where 'type' is usually 'OK' or 'NO', and 'data' is either the text from the tagged response, or untagged results from command. Each 'data' is either a string, or a tuple. If a tuple, then the first part is the header of the response, and the second part contains the data (i.e., 'literal' value).

Errors raise the exception class .error(""). IMAP4 server errors raise .abort(""), which is a sub-class of 'error'. Mailbox status changes from READ-WRITE to READ-ONLY raise the exception class .readonly(""), which is a sub-class of 'abort'.

Note: to use this module, you must read the RFCs pertaining to the IMAP4 protocol, as the semantics of the arguments to each IMAP4 command are left to the invoker, not to mention the results. Also, most IMAP servers implement a sub-set of the commands available here.

Methods defined here:

Data descriptors defined here:

Data and other attributes defined here:

๐Ÿท๏ธ class IMAP4_SSL(IMAP4)

IMAP4_SSL(host='', port=993, keyfile=None, certfile=None, ssl_context=None, timeout=None)

๐Ÿ”’ IMAP4 client class over SSL connection.

Instantiate with: IMAP4_SSL([host[, port[, keyfile[, certfile[, ssl_context[, timeout=None]]]]]])

For more documentation see the docstring of the parent class IMAP4.

Methods defined here:

All other methods are inherited from IMAP4 (see above).

๐Ÿท๏ธ class IMAP4_stream(IMAP4)

IMAP4_stream(command)

๐Ÿ“ก IMAP4 client class over a stream.

Instantiate with: IMAP4_stream(command) where "command" is a string that can be passed to subprocess.Popen().

For more documentation see the docstring of the parent class IMAP4.

Methods defined here:

All other methods are inherited from IMAP4 (see above).

๐Ÿ”ง FUNCTIONS

๐Ÿ“Š DATA

__all__ = ['IMAP4', 'IMAP4_stream', 'Internaldate2tuple', 'Int2AP', 'P...

๐Ÿ“Œ VERSION

2.58

๐Ÿ“ FILE

/usr/lib/python3.10/imaplib.py

imaplib
๐Ÿ“˜ NAME ๐Ÿš€ Quick Reference ๐Ÿ“š MODULE REFERENCE ๐Ÿ“– DESCRIPTION ๐Ÿ“ฆ CLASSES
๐Ÿท๏ธ class IMAP4(builtins.object) ๐Ÿท๏ธ class IMAP4_SSL(IMAP4) ๐Ÿท๏ธ class IMAP4_stream(IMAP4)
๐Ÿ”ง FUNCTIONS ๐Ÿ“Š DATA ๐Ÿ“Œ VERSION ๐Ÿ“ FILE

Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 16:57 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!

^_top_^