class smtplib.SMTP_SSL(host='', port=0, local_hostname=None, keyfile=None, certfile=None, [timeout, ]context=None, source_address=None)
An SMTP_SSL
instance behaves exactly the same as instances of SMTP
. SMTP_SSL
should be used for situations where SSL is required from the beginning of the connection and using starttls()
is not appropriate. If host is not specified, the local host is used. If port is zero, the standard SMTP-over-SSL port (465) is used. The optional arguments local_hostname, timeout and source_address have the same meaning as they do in the SMTP
class. context, also optional, can contain a SSLContext
and allows configuring various aspects of the secure connection. Please read Security considerations for best practices.
keyfile and certfile are a legacy alternative to context, and can point to a PEM formatted private key and certificate chain file for the SSL connection.
Changed in version 3.3: context was added.
Changed in version 3.3: source_address argument was 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.