You are here:
Use Merge Fields for Visualforce Email Templates in Salesforce Classic
A merge field is a field you can put in an email template, mail merge template, custom link, or formula to incorporate values from a record.
Required Editions
| Available in: Salesforce Classic |
Available in: Group, Enterprise, Performance, Unlimited, Developer, and Contact Manager Editions Mass email not available in: Personal, Contact Manager, and Group Editions |
| User Permissions Needed | |
|---|---|
| To set version settings for Visualforce email templates: | Customize Application |
Syntax and Formatting
Merge fields for Visualforce email templates use the same expression language as formulas:
{!Object_Name.Field_Name}For
example, you can start your email template with Hello,
{!Contact.FirstName}. When you send the template, each recipient sees their
first name in place of the merge field. If your recipient’s first name is John,
he sees Hello, John! when he opens the email.
Tips
- You can’t send a mass email using a Visualforce email template.
{!Receiving_User.field_name}and{!Sending_User.field_name}are used for mass email and aren’t available for Visualforce email templates. - To translate Visualforce email templates based on recipients’ or related objects’
languages, use the
<messaging:emailTemplate>tag’s language attribute. Valid values are Salesforce-supported language keys, such as “en-us” for English (US). The language attribute accepts merge fields from the email template’s recipientType and relatedToType attributes. You create custom language fields for use in the merge fields. The Translation Workbench is required to translate email templates. - When
renderUsingSystemContextWithoutSharing="True", the email template runs in system mode, which bypasses user permissions, field-level security, and organization-wide defaults. Be careful when using this setting so that you don't inadvertently expose sensitive data. Before using this setting, assess the impact of the guest security policy and, if necessary, update the Visualforce email templates instead. - Because the merge field Case Thread Token is supported in Lightning Experience only, you can’t use it in a Visualforce email template.

