PyDocs

Nav

Internet Protocols and Support

SMTP.starttls

smtplib

method of SMTP (source) not WASI
  • SMTP.starttls(*, context=None)
Puts the connection to the SMTP server into TLS mode.

If there has been no previous EHLO or HELO command this session, this
method tries ESMTP EHLO first.

If the server supports TLS, this will encrypt the rest of the SMTP
session. If you provide the context parameter,
the identity of the SMTP server and client can be checked. This,
however, depends on whether the socket module really checks the
certificates.

This method may raise the following exceptions:

 SMTPHeloError            The server didn't reply properly to
                          the helo greeting.
Changed in 3.3, 3.4, 3.5, 3.12
  • 3.3: context was added.
  • 3.4: The method now supports hostname check with ssl.SSLContext.check_hostname and Server Name Indicator (see HAS_SNI).
  • 3.5: The error raised for lack of STARTTLS support is now the SMTPNotSupportedError subclass instead of the base SMTPException.
  • 3.12: The deprecated keyfile and certfile parameters have been removed.
0 Examples
No examples for smtplib/SMTP.starttls.
See Also
No see-alsos for smtplib/SMTP.starttls
0 Notes
No notes for SMTP.starttls