id: py-Email
Send emails through a configured Email Service. Access the service via services.YourEmailServiceName.
At a Glance
# Simple text email
services.EmailService.send({
"subject": "Order Confirmation",
"body": "Your order has been processed."
})
# HTML email with multiple recipients
services.EmailService.send({
"from": {
"PersonalName": "Company System"
},
"to": [
],
"subject": "Monthly Report",
"body": "<h1>Report</h1><p>See attachment.</p>"
})
Send(params)
Sends an email. Two addressing styles are supported — don't mix similar properties (e.g., use to or toList, not both).
Simple Address Strings
| Parameter | Type | Description |
|---|---|---|
from | str | Sender email address |
toList | str | Semicolon-separated recipient addresses |
ccList | str (optional) | Semicolon-separated CC addresses |
bccList | str (optional) | Semicolon-separated BCC addresses |
subject | str | Email subject |
body | str | Email body (text or HTML) |
services.EmailService.send({
"subject": "Alert: High Error Rate",
"body": f"Errors in last hour: {error_count}"
})
Structured Addresses
| Parameter | Type | Description |
|---|---|---|
from | dict | {"Address": str, "PersonalName": str} |
to | List[dict] | Array of {"Address": str, "PersonalName": str} |
cc | List[dict] (optional) | Array of {"Address": str, "PersonalName": str} |
bcc | List[dict] (optional) | Array of {"Address": str, "PersonalName": str} |
subject | str | Email subject |
body | str | Email body |
services.EmailService.send({
"from": {
"PersonalName": "Order System"
},
"to": [{
"PersonalName": "John Doe"
}],
"subject": "Order #12345 Confirmed",
"body": "Thank you for your order!"
})
Complete Example
def on_message():
order_id = message.getString(dataDictionary.type.Order.ID)
customer_email = message.getString(dataDictionary.type.Order.CUSTOMER_EMAIL)
# Send confirmation
services.EmailService.send({
"toList": customer_email,
"subject": f"Order {order_id} Confirmed",
"body": f"Your order {order_id} has been received and is being processed."
})
stream.emit(message, OUTPUT_PORT)
See Also
EmailMessage— Full message structure referenceService— Service access patterns