Patch by Per Cederqvist, seemingly approved by The Dragon:

Two problems: The SMTPRecipientsRefused class should not inherit
SMTPResponseException, since it doesn't provide the smtp_code and
smtp_error attributes.  My patch for not adding an extra CRLF was
apparently forgotten.  The enclosed patch fixes these two problems.
This commit is contained in:
Guido van Rossum 1999-04-21 16:52:20 +00:00
parent 4747f7f61d
commit 20c92283ab

View File

@ -86,7 +86,7 @@ class SMTPSenderRefused(SMTPResponseException):
self.sender = sender self.sender = sender
self.args = (code, msg, sender) self.args = (code, msg, sender)
class SMTPRecipientsRefused(SMTPResponseException): class SMTPRecipientsRefused(SMTPException):
"""All recipient addresses refused. """All recipient addresses refused.
The errors for each recipient are accessable thru the attribute The errors for each recipient are accessable thru the attribute
'recipients', which is a dictionary of exactly the same sort as 'recipients', which is a dictionary of exactly the same sort as
@ -371,8 +371,11 @@ class SMTP:
if code <> 354: if code <> 354:
raise SMTPDataError(code,repl) raise SMTPDataError(code,repl)
else: else:
self.send(quotedata(msg)) q = quotedata(msg)
self.send("%s.%s" % (CRLF, CRLF)) if q[-2:] != CRLF:
q = q + CRLF
q = q + "." + CRLF
self.send(q)
(code,msg)=self.getreply() (code,msg)=self.getreply()
if self.debuglevel >0 : print "data:", (code,msg) if self.debuglevel >0 : print "data:", (code,msg)
return (code,msg) return (code,msg)