Skip to content

Email Module

SDK reference for sending emails via the platform's configured email workflow

The email module sends transactional email through the platform’s configured email workflow. The platform admin must configure an email workflow under Settings -> Email before this works.

from bifrost import email
MethodReturnsDescription
email.send()dictSend a plain-text or HTML email

Send an email through the configured email workflow. Resolves the current execution scope automatically.

async def send(
recipient: str,
subject: str,
body: str,
html_body: str | None = None,
) -> dict
ParameterTypeDescription
recipientstrRecipient email address
subjectstrSubject line
bodystrPlain-text body
html_bodystr | NoneOptional HTML body

Returns a dict with:

KeyTypeDescription
successboolWhether the email was queued/sent successfully
execution_idstr | NoneExecution ID of the underlying email workflow
errorstr | NoneError message when success is False
from bifrost import email, workflow
@workflow
async def notify_invoice_ready(recipient: str, invoice_url: str):
"""Send the customer an invoice-ready notification."""
result = await email.send(
recipient=recipient,
subject="Your invoice is ready",
body=f"Download your invoice here: {invoice_url}",
html_body=f'<p>Download your <a href="{invoice_url}">invoice</a>.</p>',
)
if not result["success"]:
raise RuntimeError(f"Email failed: {result['error']}")
return {"sent": True, "execution_id": result["execution_id"]}