admin.py 文件源码

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

项目:Sentry 作者: NetEaseGame 项目源码 文件源码
def status_mail(request):
    form = TestEmailForm(request.POST or None)

    if form.is_valid():
        body = """This email was sent as a request to test the Sentry outbound email configuration."""
        try:
            send_mail(
                '%s Test Email' % (settings.EMAIL_SUBJECT_PREFIX,),
                body, settings.SERVER_EMAIL, [request.user.email],
                fail_silently=False
            )
        except Exception as e:
            form.errors['__all__'] = [six.text_type(e)]

    return render_to_response('sentry/admin/status/mail.html', {
        'form': form,
        'EMAIL_HOST': settings.EMAIL_HOST,
        'EMAIL_HOST_PASSWORD': bool(settings.EMAIL_HOST_PASSWORD),
        'EMAIL_HOST_USER': settings.EMAIL_HOST_USER,
        'EMAIL_PORT': settings.EMAIL_PORT,
        'EMAIL_USE_TLS': settings.EMAIL_USE_TLS,
        'SERVER_EMAIL': settings.SERVER_EMAIL,
    }, request)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号