# How To: Email Generation

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

This pattern works well when your Flow generates a document first, then emails that document in the same Flow.

{% hint style="info" %}
Before you start:

* Use a **Flow** that can run the **Send Email** action
* Activate and test the Flow in Salesforce
* Make sure the Flow can access the base record and any generated **SDoc** records
* Have the **S-Docs Email Template** name or ID ready
* If you generate a document earlier in the Flow, store the returned **SDoc ID** so you can use it as an attachment
  {% endhint %}

### Configure the action in Flow

{% stepper %}
{% step %}

#### Step 1 — Add the action element

Add an **Action** element to the Flow.

Select the S-Docs **Send Email** invocable action.

<figure><img src="/files/LtbjnGgo77srz3DdpXyf" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Step 2 — Set the required values

Map these values:

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

For **Attachments**, pass the **SDoc ID** of each document you want to send.

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

<figure><img src="/files/ALCj0mffMYxYIklWTG3t" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Step 3 — Configure the remaining settings

Set any additional values your Flow needs, such as:

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

<figure><img src="/files/GkqS3QAU4hvyrHO0TcZE" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

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

Run the Flow and confirm it:

* uses the correct **Base Record ID**
* uses the expected email template
* attaches the correct **SDoc** records
* sends the email with the expected recipients and subject
  {% endstep %}
  {% endstepper %}

### Attachment behavior

Use **Attachments** to pass the **SDoc ID** values for the documents you want to send.

If the Flow generates a document first, use that generated **SDoc ID** as the attachment value.

### Invocable action field reference

Use these action fields when you configure **Send Email** in Flow:

* **Base Record ID** — the Salesforce record used for merge field context
* **S-Docs Email Template Name or ID** — the email template to load
* **Attachments** — the **SDoc ID** values for the documents to send
* **Recipient Email Address** — the primary recipient
* **CC Recipient Email Address** — optional carbon copy recipients
* **BCC Recipient Email Address** — optional blind carbon copy recipients
* **Org-Wide Email Address** — the sender address when you use an org-wide email
* **Subject Line** — the email subject override
* **System Mode Generation (Experience Cloud)** — controls system mode behavior for Experience Cloud use cases

### Related guides

* [How To: Email Editor In Flow](/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-email-editor-in-flow.md)
* [How To: Generate Documents in Batch](/sdocs/automation-and-document-lifecycle/automate-with-flow/how-to-generate-documents-in-batch.md)
* [How To: Sending Generated Documents via Email](/sdocs/automation-and-document-lifecycle/workflows/sending-generated-documents-via-email-s-docs-lwc.md)
* [HTML Email Templates](/sdocs/template-architecture/document-formats/html-email-format.md)


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
