diff options
author | rubenwardy <rw@rubenwardy.com> | 2019-01-04 19:17:04 +0000 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2019-01-04 19:17:04 +0000 |
commit | 014370ea067d3abaef1eddde15bd3fa3fbafd2a3 (patch) | |
tree | 599c2f469650a0dc035be497525048a4936849fc /app/tasks | |
parent | fbf374ff5d72722d14f07cc4ee71a5182212db94 (diff) | |
download | cheatdb-014370ea067d3abaef1eddde15bd3fa3fbafd2a3.tar.xz |
Add email template
Diffstat (limited to 'app/tasks')
-rw-r--r-- | app/tasks/emails.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/app/tasks/emails.py b/app/tasks/emails.py index ba3215a..faeeb9d 100644 --- a/app/tasks/emails.py +++ b/app/tasks/emails.py @@ -15,7 +15,7 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. -from flask import * +from flask import render_template from flask_mail import Message from app import mail from app.tasks import celery @@ -32,8 +32,10 @@ def sendVerifyEmail(newEmail, token): 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 + + html = html or text + msg.html = render_template("emails/base.html", subject=subject, content=html) mail.send(msg) |