summaryrefslogtreecommitdiff
path: root/pgcommitfest/mailqueue
diff options
context:
space:
mode:
authorMagnus Hagander2015-01-22 14:04:09 +0000
committerMagnus Hagander2015-01-22 14:04:09 +0000
commit0c58317302c0eeea57dcbafa28b5150b82eba3de (patch)
tree2f02f27f4780e89b1bd9918ceb7f6f1477328ad8 /pgcommitfest/mailqueue
parentc80b7e1d58f3bac19a6df99ddf3d4bfc50e6a2ee (diff)
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.
Diffstat (limited to 'pgcommitfest/mailqueue')
-rw-r--r--pgcommitfest/mailqueue/util.py8
1 files changed, 8 insertions, 0 deletions
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')