Skip to main content

Manage transactional email templates from the Django admin — editable layouts, preview, and test send without deploys.

Project description

django-simple-email

PyPI Python Django License: MIT

Edit your transactional email templates from the Django admin. No redeploy. No template files. Just open the admin, change the copy, and send a test to see it live.


The problem it solves

Normally, changing the text in a transactional email means editing a file, committing, pushing, and waiting for a deploy. With django-simple-email, templates live in the database. Anyone with admin access can edit them, and a Preview + Send test button lets you confirm the result before it ever reaches a real user.


Install

pip install django-simple-email

Add to INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "django_simple_email",
]

Run migrations:

python manage.py migrate

That's it.


Core concepts

EmailLayout

A layout is a reusable envelope: a header and a footer that wrap the content of multiple templates. Define your brand header once — logo, colors, top bar — and reuse it across every email.

Layouts are optional. A template without a layout renders its body directly.

EmailTemplate

A template is the email itself: subject, HTML body, and an optional plain-text fallback. Both subject and html_body support Django template syntax, so you can use {{ variable }}, {% if %}, {% for %}, and everything else Django templates offer.

Each template stores a sample_context — a JSON object with example values. This is what Preview and Send test use, so you always have realistic data to work with.


Sending email from code

from django_simple_email.sending import send_email

send_email(
    template_name="welcome",
    to=["user@example.com"],
    context={"name": "Ana", "cta_url": "https://example.com/dashboard"},
)

The context you pass is merged on top of the template's sample_context. Both subject and html_body are rendered as Django templates with the merged context before sending.

send_email uses whatever EMAIL_BACKEND you have configured — no lock-in.


Admin features

Templates list

The templates list shows a Preview HTML link and a Send test button per row, so you can check any template without opening it.

Change page

When editing a template, the Metadata section at the bottom has:

  • Preview HTML — opens the fully rendered email (layout + body) in a new tab
  • Send test — renders and sends the email to DJANGO_SIMPLE_EMAIL_TEST_RECIPIENT immediately, showing a success or error message inline

Settings

Setting Default Description
DJANGO_SIMPLE_EMAIL_TEST_RECIPIENT "test@test.com" Address used by the admin test-send button
# settings.py
DJANGO_SIMPLE_EMAIL_TEST_RECIPIENT = "you@yourcompany.com"

Local development

Requirements

First-time setup

git clone https://github.com/GustavoRizzo/django-simple-email.git
cd django-simple-email
poetry install
poetry run task setup          # migrate + create superuser
poetry run task load-fixtures  # load sample layouts and templates

Running

poetry run task mailpit    # Mailpit SMTP on :1025, web UI on :8025
poetry run task run-demo   # Django on localhost:8000

Go to localhost:8000/admin and log in with the superuser you created.

The fixtures include a default layout and three templates (welcome, password-reset, notification), plus seasonal layout variants (Halloween, Christmas, New Year) with matching template variations — enough to explore the preview and test-send features right away.

Tests and linting

poetry run task test
poetry run task lint
poetry run task lint-fix

Releasing

poetry version patch   # 0.1.0 → 0.1.1
poetry build
poetry publish

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_simple_email-0.1.1.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_simple_email-0.1.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file django_simple_email-0.1.1.tar.gz.

File metadata

  • Download URL: django_simple_email-0.1.1.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.0 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for django_simple_email-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9ecf5c14afe91a9d06099239c9efefecd37bb0e77034333ae2aa287bf738311d
MD5 ecc0436d61e2321cdd382a1d2c9490ec
BLAKE2b-256 4524606dfb9a41f618703effebf653bc1c3e41f66dc2b692a382883a931ba0f0

See more details on using hashes here.

File details

Details for the file django_simple_email-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: django_simple_email-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.0 Linux/6.6.87.2-microsoft-standard-WSL2

File hashes

Hashes for django_simple_email-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e485140d8412b4add04b36dee81f59820373450922bb50ec0eeb33eedbf1eedd
MD5 07c452cb5829bf84bb326d826d010ae2
BLAKE2b-256 8d057028a9696757272f4e27190dd7932dd1d36eb9cbe0e30fc59595fb37fa0c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page