summaryrefslogtreecommitdiff
path: root/pgcommitfest/mailqueue/util.py
diff options
context:
space:
mode:
authorMagnus Hagander2019-02-05 22:55:23 +0000
committerMagnus Hagander2019-02-06 09:29:00 +0000
commit463b3c1fe2e5bea061269ed9eea4b876a9eab213 (patch)
treec7f6f057b238434b4865129e2a4f61312be4d274 /pgcommitfest/mailqueue/util.py
parenta32f4007670330d05a834db1b67687ab8b8c3b34 (diff)
Fixes for pep8 compatibility
Diffstat (limited to 'pgcommitfest/mailqueue/util.py')
-rw-r--r--pgcommitfest/mailqueue/util.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pgcommitfest/mailqueue/util.py b/pgcommitfest/mailqueue/util.py
index 9abea53..7faab0f 100644
--- a/pgcommitfest/mailqueue/util.py
+++ b/pgcommitfest/mailqueue/util.py
@@ -8,6 +8,7 @@ from email import encoders
from models import QueuedMail
+
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
@@ -24,21 +25,22 @@ def send_simple_mail(sender, receiver, subject, msgtxt, sending_username, attach
if attachments:
for filename, contenttype, content in attachments:
- main,sub = contenttype.split('/')
- part = MIMENonMultipart(main,sub)
+ main, sub = contenttype.split('/')
+ part = MIMENonMultipart(main, sub)
part.set_payload(content)
part.add_header('Content-Disposition', 'attachment; filename="%s"' % filename)
encoders.encode_base64(part)
msg.attach(part)
-
# Just write it to the queue, so it will be transactionally rolled back
QueuedMail(sender=sender, receiver=receiver, fullmsg=msg.as_string()).save()
+
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, senderaccountname, receiver, subject, templatename, templateattr={}, usergenerated=False):
send_simple_mail(sender, receiver, subject,
get_template(templatename).render(templateattr),