{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}

{% block toolbar %}
    {% if collector.messagecount %}
        {% set icon %}
            <img width="23" height="28" alt="Swiftmailer" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAcCAYAAACK7SRjAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6N0NEOTU1MjM0OThFMTFFMDg3NzJBNTE2ODgwQzMxMzQiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6N0NEOTU1MjQ0OThFMTFFMDg3NzJBNTE2ODgwQzMxMzQiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLml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IQDv3AAAAAElFTkSuQmCC" />
            <span class="sf-toolbar-status">{{ collector.messageCount }}</span>
        {% endset %}
        {% set text %}
            <div class="sf-toolbar-info-piece">
                <b>Messages</b>
                <span>{{ collector.messageCount }}</span>
            </div>
            <div class="sf-toolbar-info-piece">
                <b>Is spooled ?</b>
                <span>{{ collector.isSpool ? 'yes' : 'no' }}</span>
            </div>
        {% endset %}
        {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
    {% endif %}
{% endblock %}

{% block menu %}
<span class="label">
    <span class="icon"><img src="{{ asset('bundles/webprofiler/images/profiler/mail.png') }}" alt="Configuration" /></span>
    <strong>E-Mails</strong>
    <span class="count">
        <span>{{ collector.messagecount }}</span>
    </span>
</span>
{% endblock %}

{% block panel %}
    <h2>Messages {{ collector.isSpool ? 'spooled' : 'sent' }}</h2>

    {% if not collector.messages %}
        <p>
            <em>No message sent.</em>
        </p>
    {% else %}
        {% for i, message in collector.messages %}
            <h3>Message {{ i + 1 }} / {{ collector.messagecount }}</h3>

            {% for header in message.headers.all %}
                <pre>{{ header }}</pre>
            {% endfor %}

            <p>
                <pre>{{ message.body|e('html', message.charset)|convert_encoding('UTF-8', message.charset) }}</pre>
            </p>
        {% endfor %}
    {% endif %}
{% endblock %}
