Skip to content

Commit

Permalink
Update smtplib.py
Browse files Browse the repository at this point in the history
Bug Fix: python#11998
  • Loading branch information
prrvchr committed Dec 3, 2020
1 parent 3e53301 commit d1a993c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Lib/smtplib.py
Expand Up @@ -341,6 +341,8 @@ def connect(self, host='localhost', port=0, source_address=None):
(code, msg) = self.getreply()
if self.debuglevel > 0:
self._print_debug('connect:', repr(msg))
if code == 220:
self._host = host
return (code, msg)

def send(self, s):
Expand Down Expand Up @@ -1039,7 +1041,7 @@ def _get_socket(self, host, port, timeout):
self._print_debug('connect:', (host, port))
new_socket = super()._get_socket(host, port, timeout)
new_socket = self.context.wrap_socket(new_socket,
server_hostname=self._host)
server_hostname=host)
return new_socket

__all__.append("SMTP_SSL")
Expand Down

0 comments on commit d1a993c

Please sign in to comment.