Miscellaneous debug log additions.

This commit is contained in:
Will Stott
2017-09-06 16:22:06 +01:00
parent 866a1bc72a
commit b99b55e426
2 changed files with 11 additions and 2 deletions

View File

@ -9,6 +9,7 @@ lib.py - Common functions (eg multipart e-mail)
import logging
import mimetypes
import os
from smtplib import SMTPException
try:
# Python 2 support
@ -135,7 +136,15 @@ def send_templated_mail(template_name,
content = attachedfile.read()
msg.attach(filename, content)
return msg.send(fail_silently)
logger.debug('Sending email to: {!r}'.format(recipients))
try:
return msg.send()
except SMTPException:
logger.exception('SMTPException raised while sending email to {}'.format(recipients))
if not fail_silently:
raise e
return 0
def query_to_dict(results, descriptions):