mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
#22215: have the smtplib 'quit' command reset the state.
Without this reset, starttls would fail if a connect/starttls was done after a quit, because smtplib assumed the existing value of emspt_features was accurate, but it gets reset when starttls completes (and the new value does not contain the starttls capability, since tls is already started at that point). (There may be additional places where this lack of reset was an issue as well.) Patch by Milan Oberkirch.
This commit is contained in:
parent
a64b92edd3
commit
0cff49fcf9
3 changed files with 23 additions and 0 deletions
|
|
@ -866,6 +866,10 @@ class SMTP:
|
|||
def quit(self):
|
||||
"""Terminate the SMTP session."""
|
||||
res = self.docmd("quit")
|
||||
# A new EHLO is required after reconnecting with connect()
|
||||
self.ehlo_resp = self.helo_resp = None
|
||||
self.esmtp_features = {}
|
||||
self.does_esmtp = False
|
||||
self.close()
|
||||
return res
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue