Strucsta LogoStrucsta/Documentation

Chapter 5: Delivery & Integrations

Emailing Your Documents

Target Audience: Users setting up the final mile of the workflow.

Once your document has been successfully generated by the Render step, it needs to reach its final destination. In Strucsta, the Email Sink step handles the automated delivery of your pixel-perfect PDFs.

By placing an Email Sink at the end of your Directed Acyclic Graph (DAG), you transform your workflow from a simple document generator into a fully automated distribution pipeline.

Configuring the Recipient

The most critical part of automated delivery is ensuring the document goes to the right person. The Email Sink editor gives you two routing options:

1. Fixed Email Address

Use this option if the generated document should always be sent to the same internal destination.

  • Example: A "New Client Alert" workflow that always generates a summary PDF and emails it to sales@yourcompany.com.

2. From API Field (Dynamic Routing)

Use this option to send the document directly to the user who triggered the workflow. Because Strucsta uses a flat, cumulative data context, the Email Sink step automatically detects the email fields captured during your Ingest step. By selecting the appropriate field (e.g., clientEmail), the engine will dynamically map the recipient for every individual run.


Crafting the Message

When delivering a professional document, the email itself should look just as polished as the PDF.

  • Subject Line: Define the subject of the outgoing email.
  • Email Body: The editor provides a rich HTML workspace. You can format your text, add links, and structure the exact message your client will read when they receive their document.

Pro Tip: Just like your PDF template, your email subject and body support Handlebars injection. If you captured {{clientName}} in your web form, you can confidently write your email body as: "Hi {{clientName}}, attached is your requested summary..." The runtime will parse and personalize the email before sending.


Delivery Configuration

Currently, Strucsta supports sending the document as a standard Attachment.

The PDF generated in the immediately preceding Render step is automatically intercepted, converted into a physical file, and attached to the outbound email.

Customizing the File Name

You maintain complete control over the attachment's file name. In the Delivery tab, you can define exactly what the file should be called when the user downloads it (e.g., Monthly_Report or Invoice). The system automatically appends the .pdf extension to ensure correct formatting.


Testing Delivery (Step Replay)

Testing email automation can often be tedious, requiring you to fill out dummy web forms over and over again.

Just like the visual Render step, the Email Sink supports Step Replay. If you want to test how your HTML email body renders in an actual inbox, or verify that the attachment is named correctly:

  1. Open a recent successful Run from your dashboard.
  2. Select your Email Sink step.
  3. Click the Replay Step action.

The engine will bypass the AI generation and PDF rendering, instantly firing a test email using the historical data state from that specific run.