Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop swallowing dict returned by stdlib sendmail() #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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)