views.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:isthislegit 作者: duo-labs 项目源码 文件源码
def send_test_template():
    '''
    Sends a test template to the provided address
    '''
    form = SendTestTemplateForm(request.form)
    if form.validate_on_submit():
        report = EmailReport.make_sample()
        try:
            subject = render_template_string(form.subject.data, report=report)
            text = render_template_string(form.text.data, report=report)
            email_provider.send(
                to=form.recipient.data,
                sender=g.user.email(),
                subject=subject,
                body=text)
            return jsonify({'success': True, 'message': 'Sent test email.'})
        except Exception as e:
            return json_error(400, str(e), {})
    return json_error(400, list_errors(form), {})
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号