Donutwork Docs
Entities

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:

FieldTypeDescription
tostringRequired. Primary recipient email address.
subjectstringRequired. The title of the email.
fromstringOptional. Must match one of your "Alternative Senders".
varsobjectKey-value pairs matching placeholders in the template.
attachmentsarrayList of attachment objects (see below).
cc / bccmixedString or array of additional recipients.

Attachment Object

FieldTypeDescription
filenamestringThe display name of the file (e.g., invoice.pdf).
typestringMIME type (e.g., application/pdf).
contentstringThe file content encoded in Base64.
dispositionstringattachment (default) or inline.

Relationship Call Graph

How your app interacts with the Gateway to send a document:

On this page