IntermediateEmail

IntermediateEmail(
    html,
    subject,
    rsc_email_supress_report_attachment,
    rsc_email_supress_scheduled,
    external_attachments=None,
    inline_attachments=None,
    text=None,
    recipients=None,
)

A serializable, previewable, sendable email object for data science workflows.

The IntermediateEmail 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.

Parameters

html : str

The HTML content of the email.

subject : str

The subject line of the email.

external_attachments : list[str] | None = None

List of file paths for external attachments to include.

inline_attachments : dict[str, str] | None = None

Dictionary mapping filenames to base64-encoded strings for inline attachments.

text : str | None = None

Optional plain text version of the email.

recipients : list[str] | None = None

Optional list of recipient email addresses.

rsc_email_supress_report_attachment : bool

Whether to suppress report attachments (used in some workflows).

rsc_email_supress_scheduled : bool

Whether to suppress scheduled sending (used in some workflows).

Examples

email = IntermediateEmail(
    html="<p>Hello world</p>",
    subject="Test Email",
    recipients=["user@example.com"],
)
email.write_preview_email("preview.html")

Methods

Name Description
preview_send_email Send a preview of the email to a test recipient.
write_email_message Convert the IntermediateEmail to a Python EmailMessage.
write_preview_email Write a preview HTML file with inline attachments embedded.