{% extends "django_mail_preview/base.html" %} {% block pane %}
{% if sent %}

Inbox {{ sent|length }}

{% for item in sent %} {% endfor %}
Subject From To Attachments Size Time
{{ item.meta.subject|default:"(no subject)" }} {{ item.meta.from_email }} {{ item.meta.to|join:", " }} {% if item.meta.attachments %} {% include "django_mail_preview/_clip.html" %}{{ item.meta.attachments }} {% endif %} {{ item.meta.size|filesizeformat }}
{% else %}

Mail preview

{% endif %} {% if not previews %}

No previews yet

Create previews.py in one of your apps:

# accounts/previews.py
from django_mail_preview import EmailPreview

from .emails import password_reset_email, welcome_email
from .models import User


class AccountEmails(EmailPreview):
    def password_reset(self):
        """Sent after the "forgot password" form."""
        user = User(first_name="Ada", email="ada@example.com")
        return password_reset_email(user)

    def welcome(self):
        return welcome_email(User(first_name="Ada"))

then refresh this page.

{% endif %} {% if not sent %}

Nothing captured yet

{% if backend_active %}

Send an email and it appears here.

{% else %}

Set MAILERS (Django 6.1 and later) or EMAIL_BACKEND to django_mail_preview.backends.EmailBackend and send an email.

# settings.py

# Django 6.1 and later
MAILERS = {
    "default": {"BACKEND": "django_mail_preview.backends.EmailBackend"},
}

# Django 5.2 and 6.0
EMAIL_BACKEND = "django_mail_preview.backends.EmailBackend"
{% endif %}
{% endif %}
{% endblock pane %}