<!DOCTYPE html>
<html>

<head>
    <title>TLS Report</title>
</head>

<body>
    <h3>TLS Report Summary:</h3>
    <p>Organization: {{ report.organization_name }}</p>
    <p>Date Range: {{ report.date_range.start_datetime }} to {{ report.date_range.end_datetime }}</p>
    <p>Contact: {{ report.contact_info }}</p>
    <p>Report ID: {{ report.report_id }}</p>

    <h4><b>Policies:</b></h4>
    {% for policy in report.policies %}
    <h5><b>Policy Domain:</b> {{ policy.policy.policy_domain }}</h5>
    <ul>
        <li><b>Policy Type:</b> {{ policy.policy.policy_type }}</li>
        <li><b>Policy String:</b> {{ policy.policy.policy_string | join(", ") }}</li>
        <li><b>Successful Sessions:</b> {{ policy.summary.total_successful_session_count }}</li>
        <li><b>Failed Sessions:</b> {{ policy.summary.total_failure_session_count }}</li>
    </ul>

    <ul>
        {% for mx_host in policy.policy.mx_host %}
        <li><b>Hostname:</b> {{ mx_host.hostname }}, <b>Failures:</b> {{ mx_host.failure_count }}, <b>Result:</b> {{
            mx_host.result_type }}</li>
        {% endfor %}
    </ul>

    <ul>
        {% for detail in policy.failure_details %}
        <li><b>Result:</b> {{ detail.result_type }}, <b>Sending IP:</b> {{ detail.sending_mta_ip }}, <b>Failed
                Sessions:</b> {{ detail.failed_session_count }}
            {% if detail.failure_reason_code != "" %}
            (<b>Reason:</b> {{ detail.failure_reason_code }})
            {% endif %}
        </li>
        (<b>Receiving IP:</b> {{ detail.receiving_ip }})
        (<b>Receiving MX:</b> {{ detail.receiving_mx_hostname }})
        (<b>Additional Info:</b> {{ detail.additional_info }})
        {% endfor %}
    </ul>
    {% endfor %}
</body>

</html>