# Configure Email Sending On Your Record Page

## What You'll Learn

* Connect an HTML email template to **Documents (S-Docs)**
* Preload email content when users send generated files
* Enable automatic email open after document generation
* Test the full record-page email workflow
* Troubleshoot missing templates and blank email defaults

## What You'll Build

In this tutorial, you will configure an `Opportunity` record page so users can send generated documents with a predefined email template.

By the end, you will have:

* One **Documents (S-Docs)** component tied to an HTML email template
* Optional automatic email open after generation
* A tested send-by-email workflow from the record page
* One repeatable admin setup for end users

**Estimated time:** 10 minutes

## Prerequisites

Before you start, make sure you have:

* Access to a Lightning record page that already includes **Documents (S-Docs)**
* Permission to edit Lightning record pages
* One active S-Docs HTML email template for the same base object, such as `Opportunity`
* One test record for that object
* Basic familiarity with the **Documents (S-Docs)** component
* Complete [Configure Document Generation On Your Record Page](/quick-start/document-generation/add-s-docs-lightning-components-to-a-record-page.md)
* Complete [Create Your First Email Template](/quick-start/template-building/create-your-first-email-template.md)

{% stepper %}
{% step %}

### Step 1: Open the record page in Lightning App Builder

Start on a real record for the object that uses your S-Docs setup.

For this example, use an `Opportunity`.

1. Open Salesforce.
2. Go to **Opportunities**.
3. Open one test opportunity.
4. Click the **Gear** icon.
5. Click **Edit Page**.

This opens **Lightning App Builder** for the current record page.
{% endstep %}

{% step %}

### Step 2: Select the Documents component

Now open the settings for the component that holds generated files.

1. In the page canvas, click **Documents (S-Docs)**.
2. Go to the properties panel on the right.
3. Confirm you selected the document-list component, not **Generate Documents (S-Docs)**.

You are now in the correct place to control email behavior for generated files.
{% endstep %}

{% step %}

### Step 3: Set the email template

Choose the S-Docs email template that should load when users send a document.

1. In the component properties, find **Email Template** or **Email Template Name**.
2. Enter the exact template name, or select it if a list appears.
3. Confirm the template is built for the same object as the page, such as `Opportunity`.

{% hint style="info" %}
Each **Documents (S-Docs)** component can use one email template at a time.
{% endhint %}

{% hint style="warning" %}
The selected template must use the `HTML` format. PDF templates do not load as email body templates.
{% endhint %}

What you just did:

* Connected one reusable email template to the component
* Set the default body content for the send workflow
* Matched the component to one object-specific template
  {% endstep %}

{% step %}

### Step 4: Turn on automatic email open if needed

Use this option when users usually email the document right after generation.

1. Stay in the **Documents (S-Docs)** properties panel.
2. Find **Automatically Open Email Editor**.
3. Enable the checkbox if you want the email editor to open right after generation.

Leave this off if users usually review the file before sending.

What you just did:

* Chose whether email starts automatically
* Reduced one click for high-volume send workflows
* Kept the record-page flow aligned with your team's process
  {% endstep %}

{% step %}

### Step 5: Save and activate the page

Save the component changes before testing.

1. Click **Save**.
2. Click **Activate** if Salesforce prompts you.
3. Confirm the page assignment if you manage app, record type, or profile assignments.
4. Return to the test record.

The updated page is now ready for a live test.
{% endstep %}

{% step %}

### Step 6: Generate a test document

Create one fresh document before you test the email workflow.

1. Find **Generate Documents (S-Docs)** on the same record page.
2. Generate one document from a test template.
3. Wait for the document to appear in **Documents (S-Docs)**.

{% hint style="info" %}
If the document does not appear right away, refresh the record page once.
{% endhint %}

This gives you a current file to use in the email test.
{% endstep %}

{% step %}

### Step 7: Open the email workflow and verify the result

Now confirm the component loads the expected template.

If **Automatically Open Email Editor** is enabled, the email editor may already be open.

If it is not open:

1. Find the generated document in **Documents (S-Docs)**.
2. Select the document if needed.
3. Click **Send** or **Email**.

Then verify these results:

* The email editor opens
* The expected HTML email template loads
* The subject and body match the template
* The generated document is attached
* The **To** field is populated if the template provides a value

What you just did:

* Confirmed the component-level email setup works
* Verified the user sees the expected email content
* Finished one complete record-page send test
  {% endstep %}
  {% endstepper %}

## Common Issues and Solutions

<details>

<summary>The email template does not load</summary>

Check these items:

* The component uses the correct template name
* The selected template uses the `HTML` format
* The template **Related To Type** matches the component object
* The page was saved and activated after the change

</details>

<details>

<summary>The email editor opens, but the recipient is blank</summary>

Check these items:

* The email template has a valid **To** value configured
* The source record contains data in the email field used by the template
* The merge field path in the template points to a real field on the current record or related record

If you still need to configure the template, use [Create Your First Email Template](/quick-start/template-building/create-your-first-email-template.md).

</details>

<details>

<summary>Automatically Open Email Editor does not trigger</summary>

Check these items:

* **Automatically Open Email Editor** is enabled on **Documents (S-Docs)**
* The document was newly generated from the same record page
* The page was saved after the setting changed
* Both S-Docs components are on the same active record page

</details>

<details>

<summary>The wrong email template appears</summary>

Check these items:

* You edited the correct **Documents (S-Docs)** component in App Builder
* The page does not include a second document-list component with a different template
* The template name entered in the property matches the intended record exactly

</details>

<details>

<summary>The send action is missing or unavailable</summary>

Check these items:

* A generated document exists in **Documents (S-Docs)**
* The user has permission to send email from Salesforce
* The page includes the full S-Docs record-page setup

If the record page still needs setup, use [Configure Document Generation On Your Record Page](/quick-start/document-generation/add-s-docs-lightning-components-to-a-record-page.md).

</details>

## What You've Learned

✅ Connected an HTML email template to **Documents (S-Docs)**\
✅ Enabled optional automatic email open after generation\
✅ Tested the email workflow from a Lightning record page\
✅ Verified template content and attachment behavior\
✅ Learned the most common fixes for record-page email setup

## Next Steps

* Use [Create Your First Email Template](/quick-start/template-building/create-your-first-email-template.md) to build the HTML template that loads in the email editor.
* Use [Configure Template Settings: Email](/quick-start/template-building/customize-template-settings-email.md) to control subjects, recipients, sender options, and restrictions.
* Use [Generate and Email Your Document](/quick-start/getting-started/generate-and-email-your-document.md) to test the end-user workflow from the record page.
* Use [Configure Document Generation On Your Record Page](/quick-start/document-generation/add-s-docs-lightning-components-to-a-record-page.md) if you still need the full component setup.

## Practice Exercise

Configure one test record page so users can send a generated quote with a predefined email template.

1. Open one test `Opportunity` record page in **Lightning App Builder**.
2. Set an HTML email template on **Documents (S-Docs)**.
3. Enable **Automatically Open Email Editor**.
4. Save the page and generate one document.
5. Confirm the email editor opens with the expected template and attachment.

Bonus challenges:

* Test the same setup with automatic email open turned off
* Update the email template subject and verify the new value loads
* Add this setup to another object's record page


---

# 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/quick-start/document-generation/configure-email-sending-on-your-record-page.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.
