Add email support

This commit is contained in:
rubenwardy
2018-05-14 00:40:34 +01:00
parent acc48c7262
commit 73fa5d1186
8 changed files with 91 additions and 25 deletions

View File

@@ -41,4 +41,4 @@ def make_celery(app):
celery = make_celery(app)
from . import importtasks, forumtasks
from . import importtasks, forumtasks, emails

11
app/tasks/emails.py Normal file
View File

@@ -0,0 +1,11 @@
from flask import *
from flask_mail import Message
from app import mail
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)