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 | string | Sender email address |
toList | string | Semicolon-separated recipient addresses |
ccList | string (optional) | Semicolon-separated CC addresses |
bccList | string (optional) | Semicolon-separated BCC addresses |
subject | string | Email subject |
body | string | Email body (text or HTML) |
services.EmailService.Send({
subject: 'Alert: High Error Rate',
body: `Errors in last hour: ${errorCount}`
});
Structured Addresses
| Parameter | Type | Description |
|---|---|---|
from | object | { Address, PersonalName } |
to | object[] | Array of { Address, PersonalName } |
cc | object[] (optional) | Array of { Address, PersonalName } |
bcc | object[] (optional) | Array of { Address, PersonalName } |
subject | string | Email subject |
body | string | 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
export function onMessage() {
const orderId = message.getString(dataDictionary.type.Order.ID);
const customerEmail = message.getString(dataDictionary.type.Order.CUSTOMER_EMAIL);
// Send confirmation
services.EmailService.Send({
toList: customerEmail,
subject: `Order ${orderId} Confirmed`,
body: `Your order ${orderId} has been received and is being processed.`
});
stream.emit(message, OUTPUT_PORT);
}
See Also
EmailMessage— Full message structure referenceService— Service access patterns