def send_files_deletion_email(user, files): with app.app_context(): send_email('[Flaski] Files deletion warning', sender=app.config['MAIL_USERNAME'], recipients=[user.email], text_body=render_template('email/files_deletion.txt', user=user, files=files), html_body=render_template('email/files_deletion.html', user=user, files=files),\ reply_to=app.config['MAIL_USERNAME'] )
def send_help_email(user, eapp, emsg, etime, session_file): with app.app_context(): emsg_html = emsg.split("\n") send_email('[Flaski] help needed: %s ' %eapp, sender=app.config['MAIL_USERNAME'], recipients=app.config['ADMINS'], text_body=render_template('email/app_help.txt', user=user, eapp=eapp, emsg=emsg, etime=etime, session_file=session_file), html_body=render_template('email/app_help.html', user=user, eapp=eapp, emsg=emsg_html, etime=etime, session_file=session_file),\ reply_to=user.email )
def send_submission_email(user,submission_type,submission_file, attachment_path,open_type="rb",attachment_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"): with app.app_context(): send_email('[Flaski][Automation][{submission_type}] Files have been submited for analysis.'.format(submission_type=submission_type), sender=app.config['MAIL_USERNAME'], recipients=[user.email, '*****@*****.**' ], text_body=render_template('email/submissions.txt', user=user, submission_type=submission_type, attachment_path=attachment_path), html_body=render_template('email/submissions.html', user=user, submission_type=submission_type, attachment_path=attachment_path),\ reply_to='*****@*****.**',\ attachment=submission_file , attachment_path=attachment_path ,\ open_type=open_type,\ attachment_type=attachment_type)
def send_async_email(app, msg): with app.app_context(): mail.send(msg)