mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-12 09:00:40 +00:00
Change some email settings. MAIL_DEFAULT_SENDER removed.
This commit is contained in:
12
app/email.py
12
app/email.py
@ -10,10 +10,12 @@ def send_async_email(app, msg):
|
||||
|
||||
|
||||
def send_email(to, subject, template, **kwargs):
|
||||
msg = Message('[nopaque] {}'.format(subject), recipients=[to])
|
||||
msg.body = render_template(template + '.txt.j2', **kwargs)
|
||||
msg.html = render_template(template + '.html.j2', **kwargs)
|
||||
thread = Thread(target=send_async_email,
|
||||
args=(current_app._get_current_object(), msg))
|
||||
app = current_app._get_current_object()
|
||||
msg = Message(
|
||||
'{} {}'.format(app.config['NOPAQUE_MAIL_SUBJECT_PREFIX'], subject),
|
||||
recipients=[to], sender=app.config['NOPAQUE_MAIL_SENDER'])
|
||||
msg.body = render_template('{}.txt.j2'.format(template), **kwargs)
|
||||
msg.html = render_template('{}.html.j2'.format(template), **kwargs)
|
||||
thread = Thread(target=send_async_email, args=(app, msg))
|
||||
thread.start()
|
||||
return thread
|
||||
|
Reference in New Issue
Block a user