diff options
author | Philip Jenvey <pjenvey@underboss.org> | 2014-03-12 15:34:53 -0700 |
---|---|---|
committer | Philip Jenvey <pjenvey@underboss.org> | 2014-03-12 15:34:53 -0700 |
commit | c3eaff855671da6eb73ff0a46e346c7dd1107827 (patch) | |
tree | 6d3834bce63014d64af7de32707b77199d1d8dec /lib-python/3/smtplib.py | |
parent | update python 2 stdlib to 2.7.6 (diff) | |
download | pypy-c3eaff855671da6eb73ff0a46e346c7dd1107827.tar.gz pypy-c3eaff855671da6eb73ff0a46e346c7dd1107827.tar.bz2 pypy-c3eaff855671da6eb73ff0a46e346c7dd1107827.zip |
update the Python 3 stdlib to v3.2.5
Diffstat (limited to 'lib-python/3/smtplib.py')
-rw-r--r-- | lib-python/3/smtplib.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib-python/3/smtplib.py b/lib-python/3/smtplib.py index fbef96e691..679e478295 100644 --- a/lib-python/3/smtplib.py +++ b/lib-python/3/smtplib.py @@ -742,7 +742,10 @@ class SMTP: esmtp_opts.append(option) (code, resp) = self.mail(from_addr, esmtp_opts) if code != 250: - self.rset() + if code == 421: + self.close() + else: + self.rset() raise SMTPSenderRefused(code, resp, from_addr) senderrs = {} if isinstance(to_addrs, str): @@ -751,13 +754,19 @@ class SMTP: (code, resp) = self.rcpt(each, rcpt_options) if (code != 250) and (code != 251): senderrs[each] = (code, resp) + if code == 421: + self.close() + raise SMTPRecipientsRefused(senderrs) if len(senderrs) == len(to_addrs): # the server refused all our recipients self.rset() raise SMTPRecipientsRefused(senderrs) (code, resp) = self.data(msg) if code != 250: - self.rset() + if code == 421: + self.close() + else: + self.rset() raise SMTPDataError(code, resp) #if we got here then somebody got our mail return senderrs @@ -892,13 +901,13 @@ class LMTP(SMTP): try: self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self.sock.connect(host) - except socket.error as msg: + except socket.error: if self.debuglevel > 0: print('connect fail:', host, file=stderr) if self.sock: self.sock.close() self.sock = None - raise socket.error(msg) + raise (code, msg) = self.getreply() if self.debuglevel > 0: print('connect:', msg, file=stderr) |