feat(emails): Do not auto-reply on auto-replies and add auto-reply header for auto-replies and fix headers propagation for our email messages

This commit is contained in:
Arkadiy Korotaev
2021-04-15 10:39:55 +02:00
parent fe9ff2fdc4
commit 3285d5e1a8
3 changed files with 54 additions and 23 deletions

View File

@@ -15,7 +15,7 @@ def send_templated_mail(template_name,
bcc=None,
fail_silently=False,
files=None,
extra_headers={}):
extra_headers=None):
"""
send_templated_mail() is a wrapper around Django's e-mail routines that
allows us to easily send multipart (text/plain & text/html) e-mails using
@@ -53,6 +53,8 @@ def send_templated_mail(template_name,
from helpdesk.settings import HELPDESK_EMAIL_SUBJECT_TEMPLATE, \
HELPDESK_EMAIL_FALLBACK_LOCALE
headers = extra_headers or {}
locale = context['queue'].get('locale') or HELPDESK_EMAIL_FALLBACK_LOCALE
try:
@@ -95,7 +97,8 @@ def send_templated_mail(template_name,
msg = EmailMultiAlternatives(subject_part, text_part,
sender or settings.DEFAULT_FROM_EMAIL,
recipients, bcc=bcc)
recipients, bcc=bcc,
headers=headers)
msg.attach_alternative(html_part, "text/html")
if files: