Change some email settings. MAIL_DEFAULT_SENDER removed.

This commit is contained in:
Patrick Jentsch
2020-04-20 14:24:36 +02:00
parent 8a9db7f4b8
commit 7dd27fb007
4 changed files with 13 additions and 38 deletions

View File

@ -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