raise an error when STARTTLS fails

This commit is contained in:
Benjamin Peterson 2016-06-11 13:16:42 -07:00
parent 3d4d01f614
commit 46b32f307c
2 changed files with 8 additions and 0 deletions

View file

@ -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=[],