Installation
New to Python Mailable? Start with the Introduction for an overview of what it does and why.
Requirements
Section titled “Requirements”- Python 3.13+
- Jinja2 for template rendering
Install
Section titled “Install”Add it to your project with your dependency manager of choice:
uv add python-mailableor
pip install python-mailableQuick start
Section titled “Quick start”Subclass Mailable and implement build():
from dataclasses import dataclassfrom python_mailable.mailable import Mailable
@dataclassclass OrderShipped(Mailable): user: User
def build(self): return ( self.to(self.user.email) .subject("Your order has shipped!") .template("emails/order_shipped.html.j2") .with_context({"user": self.user}) )
email = OrderShipped(user).build()html = email.render()