From bc8ec4b79b295379e104e532d55a23ef79171d00 Mon Sep 17 00:00:00 2001 From: Tyrone-Zhao Date: Sun, 24 Feb 2019 01:33:56 +0800 Subject: [PATCH 1/2] bpo-36999: Fix a bug in smtplib module --- Lib/smtplib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py index 3c5ac75ab8abe2..63ce4b5afcb209 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -1038,7 +1038,7 @@ def _get_socket(self, host, port, timeout): new_socket = socket.create_connection((host, port), timeout, self.source_address) new_socket = self.context.wrap_socket(new_socket, - server_hostname=self._host) + server_hostname=host) return new_socket __all__.append("SMTP_SSL") From e445ccbc483dfde74638dbb694132dc00ced4973 Mon Sep 17 00:00:00 2001 From: tyrone-zhao Date: Sun, 24 Feb 2019 15:21:20 +0800 Subject: [PATCH 2/2] bpo-36094: Fix a bug in smtplib module --- Lib/smtplib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/smtplib.py b/Lib/smtplib.py index 63ce4b5afcb209..2545f7dca84802 100755 --- a/Lib/smtplib.py +++ b/Lib/smtplib.py @@ -319,6 +319,7 @@ def connect(self, host='localhost', port=0, source_address=None): specified during instantiation. """ + self._host = host if source_address: self.source_address = source_address @@ -1038,7 +1039,7 @@ def _get_socket(self, host, port, timeout): new_socket = socket.create_connection((host, port), timeout, self.source_address) new_socket = self.context.wrap_socket(new_socket, - server_hostname=host) + server_hostname=self._host) return new_socket __all__.append("SMTP_SSL")