class imaplib.IMAP4_SSL(host='', port=IMAP4_SSL_PORT, keyfile=None, certfile=None, ssl_context=None)
This is a subclass derived from IMAP4
that connects over an SSL encrypted socket (to use this class you need a socket module that was compiled with SSL support). If host is not specified, ''
(the local host) is used. If port is omitted, the standard IMAP4-over-SSL port (993) is used. ssl_context is a ssl.SSLContext
object which allows bundling SSL configuration options, certificates and private keys into a single (potentially long-lived) structure. Please read Security considerations for best practices.
keyfile and certfile are a legacy alternative to ssl_context - they can point to PEM-formatted private key and certificate chain files for the SSL connection. Note that the keyfile/certfile parameters are mutually exclusive with ssl_context, a ValueError
is raised if keyfile/certfile is provided along with ssl_context.
Changed in version 3.3: ssl_context parameter added.
Changed in version 3.4: The class now supports hostname check with ssl.SSLContext.check_hostname
and Server Name Indication (see ssl.HAS_SNI
).
Please login to continue.