mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-12-26 16:48:50 +01:00
Merge pull request #547 from willstott101/email-logging
SMTP debug log additions.
This commit is contained in:
commit
f270c18a02
@ -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):
|
||||
|
@ -447,7 +447,7 @@ def ticket_from_message(message, queue, logger):
|
||||
|
||||
attached = process_attachments(f, files)
|
||||
for att_file in attached:
|
||||
logger.info("Attachment '%s' successfully added to ticket from email." % att_file[0])
|
||||
logger.info("Attachment '%s' (with size %s) successfully added to ticket from email." % (att_file[0], att_file[1].size))
|
||||
|
||||
context = safe_template_context(t)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user