summaryrefslogtreecommitdiff
path: root/Lib/smtplib.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2016-06-11 13:16:42 -0700
committerBenjamin Peterson <benjamin@python.org>2016-06-11 13:16:42 -0700
commit46b32f307c48bcb999b22eebf65ffe8ed5cca544 (patch)
tree1ef86cb8171d8418a748f86ec21c972f69b5847a /Lib/smtplib.py
parent3d4d01f614d894327bbdc1feadebd50b2d3621ff (diff)
downloadcpython-git-46b32f307c48bcb999b22eebf65ffe8ed5cca544.tar.gz
raise an error when STARTTLS fails
Diffstat (limited to 'Lib/smtplib.py')
-rwxr-xr-xLib/smtplib.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index db23ff0d20..ac1f593789 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -695,6 +695,11 @@ class SMTP:
self.ehlo_resp = None
self.esmtp_features = {}
self.does_esmtp = 0
+ else:
+ # RFC 3207:
+ # 501 Syntax error (no parameters allowed)
+ # 454 TLS not available due to temporary reason
+ raise SMTPResponseException(resp, reply)
return (resp, reply)
def sendmail(self, from_addr, to_addrs, msg, mail_options=[],