From f6479711746284f718fbf392558610b5e3c76a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 8 Aug 2018 11:32:45 +0300 Subject: [PATCH 1/3] SMTP.startssl: Fix doc on keyfile and certfile use --- Doc/library/smtplib.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index 86e769e6a1f8dc..c1d95dc320196c 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -379,8 +379,8 @@ An :class:`SMTP` instance has the following methods: commands that follow will be encrypted. You should then call :meth:`ehlo` again. - If *keyfile* and *certfile* are provided, these are passed to the :mod:`socket` - module's :func:`ssl` function. + If *keyfile* and *certfile* are provided, they are used to create an + :class:`ssl.SSLContext`. Optional *context* parameter is a :class:`ssl.SSLContext` object; This is an alternative to using a keyfile and a certfile and if specified both From 1044efd8a2db7f3b6dafc238e65e1407bf63de7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 8 Aug 2018 11:33:15 +0300 Subject: [PATCH 2/3] SMTP.startssl: Add missing keyfile and certfile deprecation notice --- Doc/library/smtplib.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index c1d95dc320196c..aa2598bc83a621 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -389,6 +389,13 @@ An :class:`SMTP` instance has the following methods: If there has been no previous ``EHLO`` or ``HELO`` command this session, this method tries ESMTP ``EHLO`` first. + .. deprecated:: 3.6 + + *keyfile* and *certfile* are deprecated in favor of *context*. + Please use :meth:`ssl.SSLContext.load_cert_chain` instead, or let + :func:`ssl.create_default_context` select the system's trusted CA + certificates for you. + :exc:`SMTPHeloError` The server didn't reply properly to the ``HELO`` greeting. From 456fd69079b8fd59d943c13b5f5f5fe98fb7555b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 8 Aug 2018 11:33:59 +0300 Subject: [PATCH 3/3] SMTP: Doc grammar fixes --- Doc/library/smtplib.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/smtplib.rst b/Doc/library/smtplib.rst index aa2598bc83a621..e5effd0306a401 100644 --- a/Doc/library/smtplib.rst +++ b/Doc/library/smtplib.rst @@ -271,7 +271,7 @@ An :class:`SMTP` instance has the following methods: .. method:: SMTP.ehlo_or_helo_if_needed() - This method call :meth:`ehlo` and or :meth:`helo` if there has been no + This method calls :meth:`ehlo` and/or :meth:`helo` if there has been no previous ``EHLO`` or ``HELO`` command this session. It tries ESMTP ``EHLO`` first. @@ -382,7 +382,7 @@ An :class:`SMTP` instance has the following methods: If *keyfile* and *certfile* are provided, they are used to create an :class:`ssl.SSLContext`. - Optional *context* parameter is a :class:`ssl.SSLContext` object; This is + Optional *context* parameter is an :class:`ssl.SSLContext` object; This is an alternative to using a keyfile and a certfile and if specified both *keyfile* and *certfile* should be ``None``.