Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions repoze/sendmail/mailer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)