Mercurial > public > sg101
diff news/views.py @ 892:79a71b9d0a2a
Use Reply-To header when sending mail from other users.
See issue #81.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 16 Feb 2015 20:30:48 -0600 |
parents | ff645a692791 |
children | 19b86e684cc2 |
line wrap: on
line diff
--- a/news/views.py Mon Feb 16 18:58:49 2015 -0600 +++ b/news/views.py Mon Feb 16 20:30:48 2015 -0600 @@ -3,6 +3,7 @@ """ import datetime +from django.conf import settings from django.shortcuts import render_to_response from django.template import RequestContext from django.template.loader import render_to_string @@ -201,11 +202,11 @@ if request.method == 'POST': send_form = SendStoryForm(request.POST) if send_form.is_valid(): + site = Site.objects.get_current() to_name = send_form.name() to_email = send_form.email() from_name = get_full_name(request.user) - from_email = request.user.email - site = Site.objects.get_current() + from_email = settings.GPP_NO_REPLY_EMAIL + '@' + site.domain msg = render_to_string('news/send_story_email.txt', { @@ -218,7 +219,7 @@ }) subject = 'Interesting Story at ' + site.name - send_mail(subject, msg, from_email, [to_email]) + send_mail(subject, msg, from_email, [to_email], reply_to=request.user.email) return HttpResponseRedirect(reverse('news.views.email_thanks')) else: send_form = SendStoryForm()