blob: 4f48eaec8b016e638ac8c4f7d1f8e22ece1326f3 [file] [log] [blame]
Fatih Degirmencic2a46012019-09-30 12:07:45 +02001from threading import Thread
2
3from flask import current_app
4from flask_mail import Message
5from app import mail
6
7# TODO: enable threading
8
9def send_async_email(app, msg):
10 with app.app_context():
11 mail.send(msg)
12
13def send_email(subject, recipients, email_body_html):
14 msg = Message(subject,
15 recipients=[recipients],
16 html=email_body_html,
17 sender=('Nordix Open Labs', 'noreply@nordix.org'))
18
19# Thread(target=send_async_email, args=(app, msg)).start()
20 mail.send(msg)
21
Fatih Degirmenci594a58d2019-10-01 12:53:53 +000022def notify_admins(subject, user_identifier):
23 msg = Message(subject,
24 recipients=['fdegir@gmail.com'],
25 sender=('Nordix Open Labs', 'noreply@nordix.org'))
26
27 msg.body = 'New user mail address is ' + user_identifier
28 mail.send(msg)
29
Fatih Degirmencic2a46012019-09-30 12:07:45 +020030#def send_email(user, template):
31# send_email('Welcome to Nordix Labs!',
32# recipients=[user.email],
33# html=template)