Rule Effect
sendEmail
Back to IndexReturn this effect to queue an email for delivery through the Sendings system.
Type
{ effect: 'sendEmail' to: text subject: text body: { plainText: text | nothing html: text | nothing } cc: [text] | nothing bcc: [text] | nothing from: text | nothing fromName: text | nothing replyTo: text | nothing category: text | nothing dynamic: {text->text} | nothing}Fields
| Field | Type | Required | Description |
|---|---|---|---|
effect | 'sendEmail' | Yes | Must be 'sendEmail' |
to | text | Yes | Recipient email address |
subject | text | Yes | Email subject line |
body | record | Yes | Email body (at least one of plainText or html required) |
body.plainText | text | No | Plain text version of the email |
body.html | text | No | HTML version of the email |
cc | [text] | No | CC recipients |
bcc | [text] | No | BCC recipients |
from | text | No | Sender email address (uses system default if not specified) |
fromName | text | No | Sender display name |
replyTo | text | No | Reply-to email address |
category | text | No | Email category for tracking (defaults to 'rule') |
dynamic | {text->text} | No | Custom metadata/tracking data |
Example
param input: OnOrderCreated
from { effect = 'sendEmail' to = input.order.invoiceAddress.email subject = 'Order Confirmation - ' + input.order.orderNumber body = { plainText = 'Thank you for your order!' html = '<h1>Thank you for your order!</h1><p>Order number: ' + input.order.orderNumber + '</p>' } category = 'order-confirmation' dynamic = { orderId = input.order.orderId :: text orderNumber = input.order.orderNumber }}Notes
- At least one of
body.plainTextorbody.htmlmust be provided - Emails are queued for delivery and sent asynchronously
- The
categoryfield defaults to'rule'if not specified - Email delivery status can be tracked via the Sendings Graph Node
See Also
- Sendings API - Email delivery system
- Sending Graph Node - Query email status
- scheduleJob - Schedule jobs from rules