from nbmail import Email
Email(
html="<p>Hello world</p>",
subject="Test Email",
recipients=["user@example.com"],
)email subject: Test Email
Hello world
A serializable, previewable, sendable email object for data science workflows.
The Email class provides a unified structure for representing email messages, including HTML and plain text content, subject, inline or external attachments, and recipients. It is designed to be generated from a variety of authoring tools and sent via multiple providers.
html : strThe HTML content of the email.
subject : strThe subject line of the email.
external_attachments : list[str] = list()List of file paths for external attachments to include.
inline_attachments : dict[str, str] = dict()Dictionary mapping filenames to base64-encoded strings for inline attachments.
text : str | None = NoneOptional plain text version of the email.
recipients : list[str] | None = NoneOptional list of recipient email addresses.
email_suppress_report_attachment : bool | None = NoneWhether to suppress report attachments (used in some workflows).
email_suppress_scheduled : bool | None = NoneWhether to suppress scheduled sending (used in some workflows).
| Name | Description |
|---|---|
| preview_send_email | Send a preview of the email to a test recipient. |
| write_email_message | Convert the Email to a Python EmailMessage. |
| write_preview_email | Write a preview HTML file with inline attachments embedded. |
| write_quarto_json | Write the Email to Quarto’s output metadata JSON format. |