From 0c58317302c0eeea57dcbafa28b5150b82eba3de Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Thu, 22 Jan 2015 15:04:09 +0100 Subject: Implement support for secondary email addresses Each user can add a secondary email (well, more than one) and then pick one of those when sending email. Addresses are validated by sending a token to the newly added address, with a link to click to confirm it. Only a fully confirmed address can actually be used. --- pgcommitfest/mailqueue/util.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pgcommitfest/mailqueue/util.py') diff --git a/pgcommitfest/mailqueue/util.py b/pgcommitfest/mailqueue/util.py index 60afd5d..38e1145 100644 --- a/pgcommitfest/mailqueue/util.py +++ b/pgcommitfest/mailqueue/util.py @@ -1,3 +1,6 @@ +from django.template import Context +from django.template.loader import get_template + from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.nonmultipart import MIMENonMultipart @@ -35,3 +38,8 @@ def send_simple_mail(sender, receiver, subject, msgtxt, sending_username, attach def send_mail(sender, receiver, fullmsg): # Send an email, prepared as the full MIME encoded mail already QueuedMail(sender=sender, receiver=receiver, fullmsg=fullmsg).save() + +def send_template_mail(sender, receiver, subject, templatename, templateattr={}, usergenerated=False): + send_simple_mail(sender, receiver, subject, + get_template(templatename).render(Context(templateattr)), + '__internal') -- cgit v1.2.3