← Back to all products
$29
Transactional Templates
Responsive HTML templates for transactional emails — welcome, password reset, invoice, and more.
JSONMarkdownPython
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 10 files
transactional-templates/
├── LICENSE
├── README.md
├── examples/
│ └── welcome_vars.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ ├── 03_variables-file-format.md
│ └── 04_faq.md
├── index.html
└── src/
└── transactional_templates.py
📖 Documentation Preview README excerpt
Transactional Templates
Responsive HTML email templates for transactional emails — welcome, password reset, invoice, shipping, and verification. Jinja-style {{variable}} placeholders with conditional block support.
Features
- 5 built-in templates — Welcome, Password Reset, Invoice, Shipping Notification, Email Verification
- Responsive 600px layout — Works on desktop and mobile email clients
- Mustache-like substitution —
{{variable}}for values,{{#var}}...{{/var}}for conditional blocks - Brand customization — Colors, logo, company name, support email, and address
- Preview with sample data — See how templates look before wiring them up
- CAN-SPAM compliant — Footer includes physical address and unsubscribe link
- Zero dependencies — No Jinja, no templating libraries, pure Python stdlib
Requirements
- Python 3.10+
- No external dependencies (stdlib only)
Quick Start
# List all available templates
python src/transactional_templates.py list
# Preview a template with sample data
python src/transactional_templates.py preview welcome
# Render with your own variables
python src/transactional_templates.py render welcome --vars examples/welcome_vars.json
# Render and save to file
python src/transactional_templates.py render invoice --vars examples/welcome_vars.json -o invoice.html
Available Templates
| Template | Use Case | Key Variables |
|---|---|---|
welcome | New user signup | user_name, login_url, getting_started_url |
password_reset | Password reset request | user_name, reset_url, expiry_minutes |
invoice | Payment receipt | user_name, invoice_number, items, total |
shipping | Order shipped | user_name, tracking_number, tracking_url, carrier |
verification | Email verification | user_name, verify_url, expiry_hours |
Variables File Format
{
"user_name": "Alex",
"login_url": "https://acme-corp.example.com/login",
"getting_started_url": "https://acme-corp.example.com/docs",
"brand": {
"company_name": "Acme Corp",
"brand_color": "#2563EB",
"support_email": "support@acme-corp.example.com"
}
}
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/transactional_templates.py
#!/usr/bin/env python3
"""
Transactional Templates — Email Arsenal (DataNest)
Collection of responsive HTML email templates for transactional emails.
Renders templates with variable substitution from JSON config files.
Includes: welcome, password reset, invoice, shipping, and verification.
Usage:
python transactional_templates.py list
python transactional_templates.py render welcome --vars vars.json
python transactional_templates.py render invoice --vars invoice_data.json -o invoice.html
python transactional_templates.py preview welcome
Dependencies: Python 3.10+ stdlib only
License: MIT
"""
from __future__ import annotations
import argparse
import html
import json
import logging
import re
import sys
from dataclasses import dataclass
from datetime import datetime, timezone
from pathlib import Path
from string import Template
from typing import Any
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
logger = logging.getLogger("transactional_templates")
# Default brand settings — customize per project
DEFAULT_BRAND = {
"company_name": "Acme Corp",
"brand_color": "#2563EB",
"text_color": "#374151",
"bg_color": "#F9FAFB",
"logo_url": "",
"support_email": "support@acme-corp.example.com",
"website_url": "https://acme-corp.example.com",
"address": "123 Example Street, San Francisco, CA 94102",
"unsubscribe_url": "https://acme-corp.example.com/unsubscribe",
}
# ... 425 more lines ...