Email Delivery Entity
Understanding the Email job lifecycle, dynamic templates, and attachment handling.
Email Delivery Entity
The Email Delivery (or Email Job) represents a single transactional communication event. It bridges your application logic with the professional SMTP infrastructure of DonutWork.
Usage
The Email Delivery entity is used to:
- Send transactional emails (receipts, password resets) using pre-defined templates.
- Inject dynamic data into responsive layouts via variables.
- Distribute legal or technical documents as secure attachments.
- Orchestrate multi-sender communication (Support, Billing, Sales).
Expected Delivery Flow
Sending a secure email with attachments follows this operational path:
Template Selection
Identify the logical templateId in your Email Gateway. This defines the visual layout and the placeholders available for injection.
Variable Mapping & Context
Prepare the vars object containing the dynamic data (e.g., customer name, order number) that will replace the placeholders in the designer.
Attachment Encoding
Convert your files (PDF, CSV, Images) into Base64 strings. DonutWork processes these strings to recreate valid SMTP attachments safely.
Dispatch & Transmission
Submit a POST request to the delivery endpoint. DonutWork validates the sender identity, resolves the variables, attaches the files, and transmits via the configured SMTP.
Data Schema (JSON Body)
The payload for an email delivery job:
| Field | Type | Description |
|---|---|---|
to | string | Required. Primary recipient email address. |
subject | string | Required. The title of the email. |
from | string | Optional. Must match one of your "Alternative Senders". |
vars | object | Key-value pairs matching placeholders in the template. |
attachments | array | List of attachment objects (see below). |
cc / bcc | mixed | String or array of additional recipients. |
Attachment Object
| Field | Type | Description |
|---|---|---|
filename | string | The display name of the file (e.g., invoice.pdf). |
type | string | MIME type (e.g., application/pdf). |
content | string | The file content encoded in Base64. |
disposition | string | attachment (default) or inline. |
Relationship Call Graph
How your app interacts with the Gateway to send a document: