diff options
author | Magnus Hagander | 2014-07-15 10:57:17 +0000 |
---|---|---|
committer | Magnus Hagander | 2014-07-15 10:57:17 +0000 |
commit | 0aa96508ec8a30dbd47eb5f5d31eabeabfc3d9a9 (patch) | |
tree | 5d25d04d5a80ab02292f771ae1b4fd61c86a2e9a | |
parent | 4ef258394dbd79aebf63f3981700c6b305190bf5 (diff) |
Include name of cf username causing emails to be sent in the headers
-rw-r--r-- | pgcommitfest/commitfest/views.py | 3 | ||||
-rw-r--r-- | pgcommitfest/mailqueue/util.py | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/pgcommitfest/commitfest/views.py b/pgcommitfest/commitfest/views.py index 0230c41..b5d6af3 100644 --- a/pgcommitfest/commitfest/views.py +++ b/pgcommitfest/commitfest/views.py @@ -279,6 +279,7 @@ def comment(request, cfid, patchid, what): msg['From'] = "%s %s <%s>" % (request.user.first_name, request.user.last_name, request.user.email) msg['Date'] = formatdate(localtime=True) msg['User-Agent'] = 'pgcommitfest' + msg['X-cfsender'] = request.user.username msg['In-Reply-To'] = '<%s>' % form.respid # We just add the "top" messageid and the one we're responding to. # This along with in-reply-to should indicate clearly enough where @@ -464,7 +465,7 @@ def send_email(request, cfid): recipients = User.objects.filter(q).distinct() for r in recipients: - send_simple_mail(request.user.email, r.email, form.cleaned_data['subject'], form.cleaned_data['body']) + send_simple_mail(request.user.email, r.email, form.cleaned_data['subject'], form.cleaned_data['body'], request.user.username) messages.add_message(request, messages.INFO, "Sent email to %s" % r.email) return HttpResponseRedirect('..') else: diff --git a/pgcommitfest/mailqueue/util.py b/pgcommitfest/mailqueue/util.py index f38272c..60afd5d 100644 --- a/pgcommitfest/mailqueue/util.py +++ b/pgcommitfest/mailqueue/util.py @@ -6,7 +6,7 @@ from email import encoders from models import QueuedMail -def send_simple_mail(sender, receiver, subject, msgtxt, attachments=None): +def send_simple_mail(sender, receiver, subject, msgtxt, sending_username, attachments=None): # attachment format, each is a tuple of (name, mimetype,contents) # content should already be base64 encoded msg = MIMEMultipart() @@ -14,6 +14,8 @@ def send_simple_mail(sender, receiver, subject, msgtxt, attachments=None): msg['To'] = receiver msg['From'] = sender msg['Date'] = formatdate(localtime=True) + msg['User-Agent'] = 'pgcommitfest' + msg['X-cfsender'] = sending_username msg.attach(MIMEText(msgtxt, _charset='utf-8')) |