From 014370ea067d3abaef1eddde15bd3fa3fbafd2a3 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 4 Jan 2019 19:17:04 +0000 Subject: Add email template --- app/tasks/emails.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'app/tasks/emails.py') 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 . -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) -- cgit v1.2.3