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

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

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

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

{% block inner %}
    <div class="page-header">
        <h2>{% trans "SMTP Settings" %}</h2>
    </div>
    <table class="table table-bordered table-striped">
        <colgroup>
            <col style="width:120px">
        </colgroup>
        <tbody>
            <tr>
                <th>{% trans "From Address" %}</th>
                <td class="code">{{ SERVER_EMAIL }}</td>
            </tr>
            <tr>
                <th>{% trans "Host" %}</th>
                <td class="code">{{ EMAIL_HOST }}:{{ EMAIL_PORT }}</td>
            </tr>
            <tr>
                <th>{% trans "Username" %}</th>
                <td class="code">{% if EMAIL_HOST_USER %}{{ EMAIL_HOST_USER }}{% else %}<em>{% trans "not set" %}</em>{% endif %}</td>
            </tr>
            <tr>
                <th>{% trans "Password" %}</th>
                <td class="code">{% if EMAIL_HOST_PASSWORD %}********{% else %}<em>{% trans "not set" %}</em>{% endif %}</td>
            </tr>
            <tr>
                <th>{% trans "TLS?" %}</th>
                <td class="code">{% if EMAIL_USE_TLS %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}</td>
            </tr>
        </tbody>
    </table>
    <div class="page-header">
        <h3>{% trans "Test Settings" %}
    </div>
    <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" value="{% blocktrans with request.user.email as email %}Send a test email to {{ email }}{% endblocktrans %}">
    </form>
{% endblock %}
