diff --git a/repoze/sendmail/mailer.py b/repoze/sendmail/mailer.py index 1bbb739..9078378 100644 --- a/repoze/sendmail/mailer.py +++ b/repoze/sendmail/mailer.py @@ -97,12 +97,15 @@ def send(self, fromaddr, toaddrs, message): 'Mailhost does not support ESMTP but a username ' 'is configured') - connection.sendmail(fromaddr, toaddrs, message) + # With multiple recipients sendmail() returns a dict that may + # contain an error for each recipient. + error_dict = connection.sendmail(fromaddr, toaddrs, message) try: connection.quit() except SSLError: - # something weird happened while quiting + # Something weird happened while quitting. connection.close() + return error_dict @implementer(IMailer) @@ -189,4 +192,4 @@ def _popen(self, *args, **kw): # pragma NO COVER Expects the same call signature as subprocess.Popen. """ kw['stdin'] = subprocess.PIPE - return subprocess.Popen(*args, **kw) + return subprocess.Popen(*args, **kw)