Commit a5f9989c authored by Weblate's avatar Weblate

Merge remote-tracking branch 'origin/master'

parents 1a9dc60e 937246ea
...@@ -31,8 +31,7 @@ from registration.signals import user_registered ...@@ -31,8 +31,7 @@ from registration.signals import user_registered
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.utils import translation as django_translation from django.utils import translation as django_translation
from django.template.loader import render_to_string from django.template.loader import render_to_string
from django.core.mail import EmailMultiAlternatives from django.core.mail import EmailMultiAlternatives, mail_admins
from django.core.mail import mail_admins
from south.signals import post_migrate from south.signals import post_migrate
...@@ -160,12 +159,12 @@ def notify_new_comment(unit, comment, user, report_source_bugs): ...@@ -160,12 +159,12 @@ def notify_new_comment(unit, comment, user, report_source_bugs):
'comment': comment, 'comment': comment,
'subproject': unit.translation.subproject, 'subproject': unit.translation.subproject,
}, },
from_email=user.email, user=user,
) )
def send_notification_email(language, email, notification, translation_obj, def send_notification_email(language, email, notification, translation_obj,
context=None, headers=None, from_email=None): context=None, headers=None, user=None):
''' '''
Renders and sends notification email. Renders and sends notification email.
''' '''
...@@ -201,7 +200,7 @@ def send_notification_email(language, email, notification, translation_obj, ...@@ -201,7 +200,7 @@ def send_notification_email(language, email, notification, translation_obj,
context['subject_template'] = subject_template context['subject_template'] = subject_template
# Render subject # Render subject
subject = render_to_string(subject_template, context) subject = render_to_string(subject_template, context).strip()
# Render body # Render body
body = render_to_string(body_template, context) body = render_to_string(body_template, context)
...@@ -213,21 +212,24 @@ def send_notification_email(language, email, notification, translation_obj, ...@@ -213,21 +212,24 @@ def send_notification_email(language, email, notification, translation_obj,
headers['Precedence'] = 'bulk' headers['Precedence'] = 'bulk'
headers['X-Mailer'] = 'Weblate %s' % weblate.VERSION headers['X-Mailer'] = 'Weblate %s' % weblate.VERSION
# Reply to header
if user is not None:
headers['Reply-To'] = user.email
if email == 'ADMINS': if email == 'ADMINS':
# Special handling for ADMINS # Special handling for ADMINS
mail_admins( mail_admins(
subject.strip(), subject,
body, body,
html_message=html_body html_message=html_body
) )
else: else:
# Create message # Create message
email = EmailMultiAlternatives( email = EmailMultiAlternatives(
settings.EMAIL_SUBJECT_PREFIX + subject.strip(), settings.EMAIL_SUBJECT_PREFIX + subject,
body, body,
to=[email], to=[email],
headers=headers, headers=headers,
from_email=from_email,
) )
email.attach_alternative( email.attach_alternative(
html_body, html_body,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment