For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create Your First Email Template

Create an HTML email template, add merge fields, and test default email behavior from an Opportunity record.

What You'll Learn

  • Create an HTML email template for Opportunity

  • Add merge fields to the email body

  • Configure default subject, recipient, and sender settings

  • Test the template with a real Salesforce record

  • Troubleshoot blank recipients and raw merge field output

What You'll Build

In this tutorial, you will build a reusable quote delivery email template for Opportunity.

By the end, you will have:

  • An HTML template that works as the email body

  • A personalized message with Opportunity and Account merge fields

  • A default subject and recipient value

  • A tested email flow ready for document delivery

Estimated time: 15 minutes

Prerequisites

Before you start, make sure you have:

  • Access to S-Docs Templates in Salesforce

  • Permission to create and edit S-Docs templates

  • One test Opportunity with an Account and a valid email field

  • Basic familiarity with merge fields such as {{!Opportunity.Name}}

If you plan to use an org-wide sender address, make sure it already exists in Salesforce.

1

Step 1: Create the email template record

Start by creating the template record that will hold the email body and email settings.

  1. Open the App Launcher.

  2. Search for S-Docs.

  3. Open S-Docs Templates.

  4. Click New.

  5. Set Template Name to a clear value, such as Opportunity Quote Email.

  6. Set Related To Type to Opportunity.

  7. Set Template Format to HTML.

  8. Click Save.

What you just did:

  • Created a template record for email content

  • Tied the template to Opportunity

  • Chose the format required for email body templates

2

Step 2: Open the template editor

Now open the editor where you will build the body and set email defaults.

  1. Open the new template record.

  2. Click Template Editor.

You are now in the editor for the new HTML template.

3

Step 3: Build the email body

Start with a short message that uses a few merge fields.

Add a body like this:

You can type the content directly in the editor, or insert fields from the field picker and build the message around them.

What you just did:

  • Added the visible email message

  • Personalized the body with record data

  • Used double-brace merge fields for template body content

4

Step 4: Set the default subject

Use a subject that tells the recipient exactly what the email contains.

  1. Open Email Settings.

  2. In Email Subject Settings, find Subject.

  3. Enter this value:

  1. Leave Lock Subject unchecked.

Example output: Quote for Renewal - Acme Corporation

Use single-brace merge fields like {!Opportunity.Name} in settings tabs. Use double-brace merge fields like {{!Opportunity.Name}} in the template body.

What you just did:

  • Added a reusable subject pattern

  • Pulled record values into the subject

  • Kept the subject editable for users

5

Step 5: Set the default recipient

Now define who receives the email by default.

  1. Stay in Email Settings.

  2. In Email Recipient Settings, find To.

  3. Enter the merge field for your email source.

Example:

If the merge field does not result into a value, feel free to use your personal email address for testing.

  1. Leave Lock To unchecked.

Use the email field that fits your process best.

If your org stores email on another related record, use that field instead.

What you just did:

  • Set a default recipient for the template

  • Pulled the value from the source record

  • Left the field open for user review and edits

6

Step 6: Set sender behavior and basic guardrails

Choose who the email appears to come from and apply any limits you need.

  1. In Email Sender Settings, find From.

  2. Select one of these options:

    • Logged in user

    • Your org-wide email address

7

Step 7: Save and test the template

Test the base version before you add more variations.

  1. Click Save.

  2. Open a test Opportunity.

  3. Generate a document with the template.

  4. Open the email action.

  5. Verify these results:

    • Subject is prefilled

    • To is prefilled when the source field has data

    • The body shows merged record values

    • From matches your selected sender option

Send one test email when everything looks correct.

What you just did:

  • Confirmed the template works with real record data

  • Verified the body, subject, and recipient behavior

  • Finished one working email template before adding refinements

Common Issues and Solutions

The subject shows raw merge field text

Check these items:

  • Use single braces in Email Settings, such as {!Opportunity.Name}

  • Do not use double braces in settings tabs

  • Save the template and generate a fresh test

The recipient field is blank

Check these items:

  • Confirm the source email field contains data on the test record

  • Confirm the field path matches the record relationship you used

  • Leave To unlocked if users may need to type the address manually

The email body does not personalize correctly

Check these items:

  • Use double braces in the body, such as {{!Opportunity.Name}}

  • Confirm the field path is valid for the template's Related To Type

  • Regenerate the email after each body change

The sender option I want is not available

Check these items:

  • Confirm the org-wide email address already exists in Salesforce

  • Confirm your user can access that sender option

  • Test with Logged in user first if you need to isolate the issue

The template does not appear in the email workflow

Check these items:

  • Confirm the template uses the correct Related To Type

  • Confirm the template is available for the object you are testing

  • Generate from a record that matches the template object

What You've Learned

✅ Created an HTML email template for Opportunity ✅ Added merge fields to the email body ✅ Configured default subject, recipient, and sender settings ✅ Tested the template with a real Salesforce record ✅ Learned the most common fixes for email template issues

Next Steps

Practice Exercise

Build a second email template for Opportunity that includes:

  1. A subject with Opportunity.Name

  2. A recipient pulled from a related email field

  3. A short body with at least two merge fields

  4. One test email sent from a real record

Bonus challenges:

  • Switch the sender to an org-wide email address

  • Add a domain restriction

  • Lock the body after the base version works

Last updated

Was this helpful?