# Email Delivery and Security

When generating and sending documents directly from Salesforce, maintaining control over your outbound communications is critical. This guide covers how to configure professional sender addresses, lock down specific email fields to prevent user error, and restrict outbound emails to approved domains.

***

### How to Configure Sender Addresses

By default, S-Docs sends emails from the address of the user who clicked "Generate." However, for official documents like invoices or contracts, you likely want these emails coming from an official company address (e.g., `sales@yourcompany.com`).

### Step 1: Create an Org-Wide Email Address (Admins Only)

Before you can use a generic company address in S-Docs, it must be verified in Salesforce.

1. In Salesforce Setup, search for and select Organization-Wide Addresses.
2. Click Add and fill in your Display Name and Email Address.
3. Select which profiles are allowed to use this address, then click Save.
4. *Important:* Check the inbox of that email address and click the Salesforce verification link.

### Step 2: Configure the Template Sender Settings

Once verified, you can assign the address to your template.

1. Open your Template Editor and navigate to the Email Settings tab.
2. Under "Email Sender Settings," click the From dropdown and select your Org-Wide Address.
3. Choose your enforcement level:
   * Restrict to Org-Wide Addresses: Check this to force users to send from the selected company address. They will not be able to use their personal email.
   * Enable user to choose/select from a picklist: Check this to give users a dropdown menu on the email page, allowing them to choose between their personal address or any Org-Wide Addresses they have permission to use.
4. Click Save.

> Pro-Tip: Adding User Signatures
>
> Even if an email comes from a generic address like `sales@yourcompany.com`, you can still include the individual user's signature for a personal touch. Check Use Salesforce Email Signature in the sender settings, and add `{{{!UserSignature}}}` to your email body. *(Note: You must use triple braces to preserve HTML formatting!)*

***

### How to Lock Email Fields

To prevent users from accidentally changing critical email settings—like altering a compliance statement or sending a quote to the wrong person—you can lock specific fields on the email dispatch page.

### Configuration Steps

1. Navigate to the Email Settings tab in the Template Editor.
2. Locate the "Email Subject Settings," "Email Recipient Settings," or "Other Email Settings" sections.
3. Enter your default text or merge fields (e.g., `{!Opportunity.Account.BillingEmail}` in the To field).
4. Check the Lock box next to the corresponding field.
5. Click Save.

When a user attempts to email this document, the locked fields will appear grayed out and cannot be edited.

### The "Locked + Blank = Hidden" Rule

Understanding this rule is key to customizing your user interface:

* Hiding Fields: If you lock a field (like CC or BCC) but leave the text value blank, that field will completely disappear from the end-user's email page.
* The "To" Field Exception: If you lock the To field and leave it blank, *the template cannot be emailed at all.* You must always provide a default address or merge field if you lock the To line.

### Common Locking Strategies

| **Scenario**        | **Fields to Lock** | **Why**                                                                              |
| ------------------- | ------------------ | ------------------------------------------------------------------------------------ |
| Customer Quotes     | Subject only       | Maintains brand standards but allows sales reps to adjust recipients.                |
| Invoices/Statements | Subject, To, Body  | Ensures automated consistency and prevents modification of financial communications. |
| Contracts           | To, CC, Body       | Ensures proper legal routing and prevents tampering with the email body.             |

***

### How to Restrict Email Domains

For highly sensitive documents, you can restrict the template so it can only be emailed to specific, approved domains (like internal company addresses or specific partner networks).

### Configuration Steps

1. Navigate to the Email Settings tab.
2. Under "Other Email Settings," locate the Email domain restriction field.
3. Enter a comma-separated list of approved domains.
   * Correct Syntax: `yourcompany.com,partnerdomain.com,approved.org`
   * Incorrect Syntax: Do not use spaces, `@` symbols, or `www`. (e.g., `✗ @company.com, partner.com`)
4. Click Save.

### How Restrictions Work

When a user clicks "Send," S-Docs checks the To, CC, and BCC fields against your restricted list. If a user tries to send a document to an unapproved domain (e.g., `competitor@example.com`), the email will fail to send, and they will receive an immediate error message listing the permitted domains.


---

# 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/template-architecture/template-settings/email-settings-tab/email-delivery-and-security.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.
