Commit d0079ac7 authored by Giuseppe Terrasi's avatar Giuseppe Terrasi

sync with rev 1276 upstream

parent a78746d5
......@@ -20,7 +20,7 @@ class MultiUserMailMessage(template.Node):
self.nodelist.render(context)
messages.append((recipient, context['subject'], context['htmlcontent'], context['textcontent'], context['embeddedmedia']))
create_and_send_mail_messages(messages,context['sender'])
create_and_send_mail_messages(messages, sender_data=context['sender'], reply_to=context['reply_to'])
@register.tag
def email(parser, token):
......
......@@ -24,9 +24,9 @@ from forum.context import application_settings
from forum.utils.html2text import HTML2Text
from threading import Thread
def send_template_email(recipients, template, context):
def send_template_email(recipients, template, context, sender=None, reply_to = None):
t = loader.get_template(template)
context.update(dict(recipients=recipients, settings=settings, sender=sender))
context.update(dict(recipients=recipients, settings=settings, sender=sender, reply_to=reply_to))
t.render(Context(context))
def create_connection():
......@@ -44,7 +44,7 @@ def create_connection():
return connection
def create_and_send_mail_messages(messages, sender_data=None):
def create_and_send_mail_messages(messages, sender_data=None, reply_to=None):
if not settings.EMAIL_HOST:
return
......@@ -57,8 +57,10 @@ def create_and_send_mail_messages(messages, sender_data=None):
sender.append('<%s>' % unicode(sender_data['email']))
sender = u'%s <%s>' % (unicode(sender_data['name']), unicode(sender_data['email']))
if reply_to == None:
reply_to = unicode(settings.DEFAULT_REPLY_TO_EMAIL)
else:
reply_to = unicode(reply_to)
try:
connection = None
......
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