The client
send_mail and deliver_mail are aliases. email_disposition and message_receipt are aliases.
Building a message
Attachments
Attach files by path using the helper method:attachments attribute directly with an array of hashes (each with fileName, contentType, and base64-encoded content):
Send a message
Check delivery status
EmailDisposition fields:
| Field | Description |
|---|---|
source_tracking_id | The tracking ID |
message_deliveries | Array of MessageDelivery structs |
errors | Array of ResponseError structs |
MessageDelivery struct has recipient and status. The status struct has delivery_status, delivery_time, opened_status, and opened_time.
Check disposition.errors? to detect API-level errors.
Common delivery_status values: delivered, opened, failed, pending.
Dynamic templates
Templates use Handlebars syntax ({{variable_name}}).
Create a template
List templates
Get a template
Update a template
Delete a template
Send a templated message
Error handling
Methods raiseRestClient::ExceptionWithResponse on HTTP errors. Rescue it to inspect the response: