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)
评论列表
文章目录