Doel
Send tenant-scoped email through data-worker-agent and notification-delivery without exposing email credentials to Element code.
Elements runtime reference / AI and delivery
sendEmailSend tenant-scoped email through data-worker-agent and notification-delivery without exposing email credentials to Element code.
sendEmail(payload=None, **kwargs) / send_email(to=None, subject=None, body=None, html_body=None, template_key=None, template_context=None, recipients=None, recipient_uids=None, data=None, attachments=None, persist_notification=None, idempotency_key=None, timeout_seconds=None)
Send tenant-scoped email through data-worker-agent and notification-delivery without exposing email credentials to Element code.
send_emailsend_email_messagemail.sendUse these fields as the Python call arguments or keyword payload for this helper.
{
"to": [
{
"email": "customer@example.com",
"displayName": "Customer"
}
],
"subject": "Your report is ready",
"body": "The report is attached.",
"attachments": [
{
"gcsUri": "gs://dashview-cache/filestore/tenant/exports/report.pdf",
"filename": "report.pdf"
}
],
"data": {
"campaign": "q1"
},
"idempotencyKey": "report-ready:customer@example.com:2026-07-06"
}
| Field | Description |
|---|---|
to/recipients | Recipient emails, user UIDs, or recipient objects such as {'email': 'customer@example.com', 'displayName': 'Customer'}. |
recipient_uids/recipientUids | Dashview user recipient UIDs. Use these when also persisting inbox notifications. |
subject | Required email subject, or title in dict payload form. |
body/html_body/htmlBody | Plain text and optional HTML body. A template key can provide body content when configured. |
template_key/templateKey | Optional notification-delivery email template key configured for the tenant. |
template_context/templateContext | Optional JSON object merged into the tenant email template context. |
data | Optional JSON object stored in notification data and template context. |
attachments | Optional GCS attachment refs with bucket/objectPath/object_path/object or gcsUri. |
persist_notification/persistNotification | Optional bool. Only applies to recipients with a UID. |
idempotency_key/idempotencyKey | Optional caller key for audit/idempotency. |
timeout_seconds/timeoutSeconds | Optional delivery timeout. |
{
"ok": true,
"sent": 1,
"failed": 0,
"skipped": 0,
"results": [
{
"recipientEmail": "customer@example.com",
"email": {
"status": "sent"
}
}
]
}
from sendEmail import sendEmail
def run():
result = sendEmail(
to=["customer@example.com"],
subject="Update",
body="Your update is ready.",
data={"campaign": "q1"},
)
return {"sent": result["sent"], "failed": result["failed"]}