blob: 4f48eaec8b016e638ac8c4f7d1f8e22ece1326f3 [file] [log] [blame]
from threading import Thread
from flask import current_app
from flask_mail import Message
from app import mail
# TODO: enable threading
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(subject, recipients, email_body_html):
msg = Message(subject,
recipients=[recipients],
html=email_body_html,
sender=('Nordix Open Labs', 'noreply@nordix.org'))
# Thread(target=send_async_email, args=(app, msg)).start()
mail.send(msg)
def notify_admins(subject, user_identifier):
msg = Message(subject,
recipients=['fdegir@gmail.com'],
sender=('Nordix Open Labs', 'noreply@nordix.org'))
msg.body = 'New user mail address is ' + user_identifier
mail.send(msg)
#def send_email(user, template):
# send_email('Welcome to Nordix Labs!',
# recipients=[user.email],
# html=template)