{% extends "sentry/bases/admin.html" %}

{% block admin-nav-mail %} class="active"{% endblock %}

{% load crispy_forms_tags %}
{% load i18n %}
{% load sentry_helpers %}

{% block title %}{% trans "Mail Configuration" %} | {{ block.super }}{% endblock %}

{% block main %}
    <h3>{% trans "SMTP Settings" %}</h3>

    <dl class="vars">
        <dt>{% trans "From Address" %}</dt>
        <dd>
<pre class="val">{{ mail_from }}</pre>
        </dd>

        <dt>{% trans "Host" %}</dt>
        <dd>
<pre class="vall">{{ mail_host }}:{{ mail_port }}</pre>
        </dd>

        <dt>{% trans "Username" %}</dt>
        <dd>
<pre class="val">{% if mail_username %}{{ mail_username }}{% else %}<em>{% trans "not set" %}</em>{% endif %}</pre>
        </dd>

        <dt>{% trans "Password" %}</dt>
        <dd>
<pre class="val">{% if mail_password %}********{% else %}<em>{% trans "not set" %}</em>{% endif %}</pre>
        </dd>

        <dt>{% trans "TLS?" %}</dt>
        <dd>
<pre class="val">{% if mail_use_tls %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</pre>
        </dd>

        <dt>{% trans "Mailing List Namespace" %}</dt>
        <dd>
<pre class="val">{{ mail_list_namespace }}</pre>
        </dd>
    </dl>

    <h3>{% trans "Test Settings" %}</h3>

    <form method="post" action="">
        {% csrf_token %}

        <p>{% trans "Send an email to your account's email address to confirm that everything is configured correctly." %}</p>

        {{ form|as_crispy_errors }}

        {% for field in form %}
            {{ field|as_crispy_field }}
        {% endfor %}

        <input type="submit" class="btn btn-default" value="{% blocktrans with request.user.email as email %}Send a test email to {{ email }}{% endblocktrans %}">
    </form>
{% endblock %}
