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) diff --git a/app/templates/emails/base.html b/app/templates/emails/base.html new file mode 100644 index 0000000..ebdf85a --- /dev/null +++ b/app/templates/emails/base.html @@ -0,0 +1,64 @@ + + + + + + +
+
+

ContentDB

+
+
+ {% block content %} +

{{ subject }}

+ + {{ content | safe }} + {% endblock %} + +
+ ContentDB © rubenwardy +
+
+
+ + diff --git a/app/templates/emails/verify.html b/app/templates/emails/verify.html index a08b174..38d488b 100644 --- a/app/templates/emails/verify.html +++ b/app/templates/emails/verify.html @@ -1,4 +1,7 @@ -

Hello!

+{% extends "emails/base.html" %} + +{% block content %} +

Hello!

This email has been sent to you because someone (hopefully you) @@ -6,12 +9,19 @@

- If this was you, then please click this link to verify the address: - - {{ url_for('verify_email_page', token=token, _external=True) }} - + If it wasn't you, then just delete this email.

- If it wasn't you, then just delete this email. + If this was you, then please click this link to verify the address:

+ + + Confirm Email Address + + +

+ Or paste this into your browser: {{ url_for('verify_email_page', token=token, _external=True) }} +

+ +{% endblock %}