From 46b32f307c48bcb999b22eebf65ffe8ed5cca544 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 11 Jun 2016 13:16:42 -0700 Subject: raise an error when STARTTLS fails --- Lib/smtplib.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Lib/smtplib.py') 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=[], -- cgit v1.2.1