CostHive/app/utils/email.py
Lunaresk c716c7c3ba feat: password recovery
Implemented the "Forgot Password" field with functionalities. If you're
self-hosting, you need to use some variables, which will be explained at
a later point in the readme and on the docker page.
2022-11-13 18:20:12 +01:00

15 lines
479 B
Python

from app import mail
from flask import current_app
from flask_mail import Message
from threading import Thread
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, sender, recipients, text_body, html_body):
msg = Message(subject, sender=sender, recipients=recipients)
msg.body = text_body
msg.html = html_body
Thread(target=send_async_email,
args=(current_app._get_current_object(), msg)).start()