Skip to main content

BentoMail

CI PyPI Python License

Build dashboard-style HTML emails in Python, without writing a line of HTML.

Metric grids, themed charts, data tables, and status notices — assembled from plain dataclasses and rendered into email that survives Outlook.

A BentoMail dashboard email in the Slate theme

Why BentoMail?

  • 📊 Dashboard layouts, not plain text. Metric card grids, inline charts, tables, and grouped sections.
  • 🧩 Components, not markup. Build the layout declaratively; the engine resolves the grid.
  • 📐 Outlook-defended. A fixed 850px parent table and integer colspan boundaries sidestep the classic Word-engine shrink-wrap bugs.
  • 🎨 Five built-in themes, each a frozen dataclass you can clone and override.
  • 📈 Charts with no temp files. Matplotlib figures are rendered in memory and attached as inline CID images.
  • ✉️ Always multipart. Every message carries a plain-text alternative alongside the HTML.
  • ⚡ One dependency. Jinja2. Charts are an optional extra.

Installation

pip install bentomail

Inline chart rendering is optional, since it pulls in matplotlib:

pip install "bentomail[charts]"

Quick Start

from bentomail import BentoMailer, themes

mail = BentoMailer(
    recipients=["team@example.com"],
    subject="Daily Infrastructure Report",
    theme=themes.GRUVBOX,
)

mail.create_header(title="Infrastructure Summary", subtitle="Production Cluster")

# Severity names resolve against the active theme's palette.
mail.add_card(title="System CPU", value="34%", color="SUCCESS")
mail.add_card(title="Active Nodes", value="14", color="INFO")
mail.add_card(title="Faults", value="0", color="WARNING")

mail.send_dashboard()

Four unassigned cards fill a row and wrap automatically. Pass colspan when you want explicit proportions.


Two ways to use it

Dashboard builds and renders. BentoMailer extends it with addressing and SMTP. If you deliver through SES, SendGrid, or the Graph API, you only need the former — it never touches SMTP config or your environment.

from bentomail import Dashboard, themes

dash = Dashboard(theme=themes.SLATE, subject="Weekly Report")
dash.add_card(title="Uptime", value="99.98%", color="SUCCESS")

html = dash.to_html()  # markup for your own transport
text = dash.to_text()  # the plain-text alternative
msg = dash.to_mime()  # MIME body with inline images, no routing headers
from bentomail import BentoMailer

mail = BentoMailer(recipients=["team@example.com"], subject="Weekly Report")
mail.add_card(title="Uptime", value="99.98%", color="SUCCESS")

msg = mail.as_mime_message()  # fully addressed
mail.send_dashboard()  # or dispatch it

Relay settings come from constructor arguments first, then the environment (SMTP_SERVER, SMTP_PORT, SMTP_USER, SMTP_PASS, SENDER_EMAIL), which can live in a .env file. TLS and SSL are inferred from ports 587 and 465 unless you set use_tls or use_ssl yourself.


Themes

Theme Preview
Slate — vibrant dark blue operations panel
Neutral — pure dark gray, minimal accent
Light — clean corporate reporting layout
Gruvbox — warm retro, high-contrast terminal
Monokai — retro code-editor palette

Full-height dashboards: Slate · Neutral · Light · Gruvbox · Monokai


Components

Component Preview
Metric cards — auto-balancing KPI grid
Data reports — tables with row highlighting
Status notices — six severities
Charts — line, bar, and pie, theme-matched

Sections group widgets inside a bordered panel and can nest:

from bentomail import BentoMailer, Section
from bentomail.components import WarningNotice

mail = BentoMailer(recipients=["team@example.com"], subject="Capacity Review")

capacity = Section(title="Capacity & Cost", subtitle="Rolling 30-day projection")
capacity.add_card(title="Storage Used", value="72%", color="WARNING")
capacity.add_bar_chart(categories=["api", "auth"], values=[120, 96], title="p99")
capacity.add_notice(WarningNotice(message="Storage crosses 80% in three weeks."))

mail.add_section(capacity)

Customization

Themes are frozen dataclasses, so cloning one is standard library work:

import dataclasses
from bentomail import BentoMailer, themes

house_style = dataclasses.replace(
    themes.NEUTRAL,
    bg_color="#000000",
    accent_color="#ff5733",
    success_color="#00ff00",
)

mail = BentoMailer(subject="Custom Alert", theme=house_style)

Attribution

Rendered dashboards carry a small "Built with BentoMail" line at the very bottom, below your own footer. To turn it off:

from bentomail import BentoMailer

mail = BentoMailer(
    recipients=["team@example.com"],
    subject="Weekly Report",
    branding=False,
)

Examples

The examples/ directory holds runnable scripts:

  • basic_alert.py — a short status email. Prints by default; --send dispatches it.
  • showcase.py — every widget in one dashboard. --theme switches palette.
  • offline_compilation.py — using BentoMail purely as an HTML pipeline, no SMTP.

How it works

  1. Components are plain dataclasses. No schema validation layer, so import and construction stay fast — which matters for cron-driven report jobs.
  2. The layout engine resolves a four-column grid. Cards accumulate into rows, wrap at the column limit, and under-filled rows are padded with transparent spacers. Widths are computed as percentages from a single formula.
  3. Rendering is confined to dashboard.jinja. Styling changes live in the template, not in Python.
  4. Messages are multipart/alternative. The plain-text part is generated from the same component tree, with charts represented by their alt text.

License

MIT. See LICENSE.

Metadata

Release files for bentomail 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bentomail 0.1.0
File Size Uploaded Provenance Actions
bentomail-0.1.0.tar.gz 42.9 kB With provenance Details for bentomail-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bentomail 0.1.0
File Interpreter ABI Platform Actions
bentomail-0.1.0-py3-none-any.whl Python 3 none any Details for bentomail-0.1.0-py3-none-any.whl

Total release size: 71.1 kB

Release files / bentomail-0.1.0.tar.gz

Download URL bentomail-0.1.0.tar.gz
Size 42.9 kB
Tags Source
SHA-256 checksum
How to use checksums
013468ec18227ee11c02898b5e3c8ad84712da705734f1d7454f7f057e877500
BLAKE2b-256 checksum
How to use checksums
7cce4379df4908a6be1103eb42b527d248eddf437a310398b4acdb667652fe1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Release files / bentomail-0.1.0-py3-none-any.whl

Download URL bentomail-0.1.0-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f1449a6076858aee566e8ba94a36fa5bf70aa68d315342031eb8f450d82e8695
BLAKE2b-256 checksum
How to use checksums
42e34aac1c2687aaa4694c5930f01118e419698b7adf497404ab2a316cf8d026
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

Security for bentomail 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bentomail-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 3, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page