diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-07-06 22:52:19 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-07-06 22:55:55 +0100 |
commit | 9dd3570a52027ecb8e84dacb87d66fc511812c3c (patch) | |
tree | 592de230866ec516d44de1131f3b64b4a549bfb2 /app/tasks | |
parent | a6c8b12cdd55906e03d79c4c776914cd43567055 (diff) | |
download | cheatdb-9dd3570a52027ecb8e84dacb87d66fc511812c3c.tar.xz |
Add email on Flask error
Diffstat (limited to 'app/tasks')
-rw-r--r-- | app/tasks/emails.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/app/tasks/emails.py b/app/tasks/emails.py index fbefbc7..5af5769 100644 --- a/app/tasks/emails.py +++ b/app/tasks/emails.py @@ -22,7 +22,17 @@ from app.tasks import celery @celery.task() def sendVerifyEmail(newEmail, token): - msg = Message("Verify email address", recipients=[newEmail]) - msg.body = "This is a verification email!" - msg.html = render_template("emails/verify.html", token=token) - mail.send(msg) + msg = Message("Verify email address", recipients=[newEmail]) + msg.body = "This is a verification email!" + msg.html = render_template("emails/verify.html", token=token) + mail.send(msg) + +@celery.task() +def sendEmailRaw(to, subject, text, html): + from flask_mail import Message + msg = Message(subject, recipients=to) + if text: + msg.body = text + if html: + msg.html = html + mail.send(msg) |