Compose an email message using simple building blocks or Markdown.
This is the primary entry point for creating emails in nbmail. It accepts optional header, body, and footer sections, processes them into MJML, and returns an Email object ready for preview or sending.
Parameters
body:Optional[Union[str, Block, BlockList]]=None
Main email content. Can be a Markdown string, single Block, or blocks() result.
Large title/header text to display at the top of the email. If provided, this creates a block_title() in the header section. Note: This is NOT the email subject line; use email metadata for that.
template:str='blastula'
Email template style. Default is “blastula”, which wraps content in a grey border container (similar to Blastula’s html_email_template_1). Use "none" for no template wrapper.
****kwargs**:={}
Additional template options (reserved for future use).
Returns
:Email
Converted Email object ready for preview or sending.
Examples
Simple email with single block:
from nbmail.compose import compose_email, block_textcompose_email( body=block_text("This is a simple email."))
This is a simple email.
Email with title/header and multiple blocks:
from nbmail.compose import compose_email, create_blocks, block_title, block_textcompose_email( title="Welcome!", body=block_text("Welcome to this week's update!"),)