> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-email-generation-updated.md).

# Send Email from Flow

Use this guide when you want a **Flow** to send an email directly with the S-Docs **Send Email** action.

Use this pattern when the Flow should send the email without a review screen.

{% hint style="info" %}
Use [Open the Email Editor in Screen Flow](/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-email-editor-in-flow-updated.md) when users should review the email before sending it.
{% endhint %}

#### Start here if you are newer to Flow

New to Flow? Start with [Getting Started: Automate Document Generation](/quick-start/document-generation/getting-started-automate-document-generation.md).

### Prerequisites

* A **Flow** that can run S-Docs actions
* Access to the base record used for merge field context
* An **S-Docs Email Template** name or ID
* One or more valid **SDoc** IDs to attach
* Recipient values in the email template, or Flow values to override them

{% hint style="warning" %}
Make sure the Flow can access the base record, the email template, and each **SDoc** you want to attach.
{% endhint %}

### Step-by-step tutorial

#### Step 1: Add the action to the Flow

Open **Flow Builder**.

Open an existing **Flow**, or create a new one.

Add an **Action** element where the email should send.

Search for and select the S-Docs **Send Email** action.

<figure><img src="/files/LtbjnGgo77srz3DdpXyf" alt="Send Email action selected in Flow"><figcaption></figcaption></figure>

#### Step 2: Map the required action fields

Map these required fields first:

* **Base Record ID**
* **S-Docs Email Template Name or ID**
* **Attachments**

Use **Base Record ID** for the Salesforce record that drives merge field context.

Use **S-Docs Email Template Name or ID** to load the email template.

Use **Attachments** to pass the **SDoc** ID for each generated document you want to send.

If the Flow generated the document earlier, map the returned **SDoc** ID from that step.

<figure><img src="/files/ALCj0mffMYxYIklWTG3t" alt="Required Send Email field mappings"><figcaption></figcaption></figure>

#### Step 3: Set any optional email overrides

Map optional fields only when the Flow should override the template or add values dynamically.

Common optional fields include:

* **Recipient Email Address**
* **CC Recipient Email Address**
* **BCC Recipient Email Address**
* **Org-Wide Email Address**
* **Subject Line**
* **System Mode Generation (Experience Cloud)**

If both the template and the Flow provide a supported value, the Flow value overrides the template.

<figure><img src="/files/GkqS3QAU4hvyrHO0TcZE" alt="Optional Send Email field mappings"><figcaption></figcaption></figure>

#### Step 4: Save, activate, and test

Save the **Flow**.

Activate it.

Then test the run and confirm it:

* uses the correct **Base Record ID**
* loads the expected email template
* attaches the expected **SDoc** records
* sends to the expected recipients
* uses the expected subject line

<figure><img src="/files/GkqS3QAU4hvyrHO0TcZE" alt="Optional Send Email field mappings before saving and testing"><figcaption></figcaption></figure>

### Troubleshooting and common errors

<details>

<summary><strong>The email sends, but the attachment is missing</strong></summary>

* **Symptom:** The email is delivered, but the expected file is not attached.
* **Cause:** The value mapped into **Attachments** is not a valid **SDoc** ID.
* **Fix:** Pass the generated **SDoc** ID from the earlier Flow step. Or confirm the stored ID still points to an existing **SDoc** record.

</details>

<details>

<summary><strong>The email uses the wrong record data</strong></summary>

* **Symptom:** Merge fields resolve from the wrong record.
* **Cause:** The wrong value was mapped into **Base Record ID**.
* **Fix:** Map the record ID that should drive the email template merge fields.

</details>

<details>

<summary><strong>The action faults in Experience Cloud</strong></summary>

* **Symptom:** The Flow fails when it reaches **Send Email** in an Experience Cloud flow.
* **Cause:** The **System Mode Generation (Experience Cloud)** value does not match the user context or access model.
* **Fix:** Review that setting and test again with the expected portal user context. Add a **Fault** path from the action if you want to capture and display the failure cleanly.

</details>

### Advanced configurations and reference

* Use [HTML Email Templates](/developer-hub/document-workflows/flow-reference.md#send-email) when you need additional details regarding the invocable action.
* **Base Record ID** sets the merge field context for the email template.
* **S-Docs Email Template Name or ID** accepts either the template name or the template record ID.
* **Attachments** expects **SDoc** IDs for the documents you want to send.
* **Recipient Email Address**, **CC Recipient Email Address**, **BCC Recipient Email Address**, and **Subject Line** can override template values.
* **System Mode Generation (Experience Cloud)** is useful when the Flow runs in Experience Cloud and standard user access is not enough.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.sdocs.com/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-email-generation-updated.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
