Пример #1
0
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, e:
            form.errors['__all__'] = [unicode(e)]
Пример #2
0
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)
Пример #3
0
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' % (options.get('mail.subject-prefix'),),
                body, options.get('mail.from'), [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,
        'mail_host': options.get('mail.host'),
        'mail_password': bool(options.get('mail.password')),
        'mail_username': options.get('mail.username'),
        'mail_port': options.get('mail.port'),
        'mail_use_tls': options.get('mail.use-tls'),
        'mail_from': options.get('mail.from'),
        'mail_list_namespace': options.get('mail.list-namespace'),
    }, request)