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
OpportunityAdd 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
OpportunityandAccountmerge fieldsA 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
Opportunitywith anAccountand a valid email fieldBasic 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.
Step 1: Create the email template record
Start by creating the template record that will hold the email body and email settings.
Open the App Launcher.
Search for
S-Docs.Open S-Docs Templates.
Click New.
Set Template Name to a clear value, such as
Opportunity Quote Email.Set Related To Type to
Opportunity.Set Template Format to
HTML.Click Save.
What you just did:
Created a template record for email content
Tied the template to
OpportunityChose the format required for email body templates
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
Step 4: Set the default subject
Use a subject that tells the recipient exactly what the email contains.
Open Email Settings.
In Email Subject Settings, find Subject.
Enter this value:
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
Step 5: Set the default recipient
Now define who receives the email by default.
Stay in Email Settings.
In Email Recipient Settings, find To.
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.
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
Step 7: Save and test the template
Test the base version before you add more variations.
Click Save.
Open a test
Opportunity.Generate a document with the template.
Open the email action.
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 userfirst 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
Use Configure Template Settings: Email to go deeper on sender controls, domain restrictions, and locked fields.
Use Generate and Email Your Document to test the full end-user workflow.
Use Get Started with Merge Fields if you want more field placement practice.
Practice Exercise
Build a second email template for Opportunity that includes:
A subject with
Opportunity.NameA recipient pulled from a related email field
A short body with at least two merge fields
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?

