You are here:
Create Visualforce Email Templates in Salesforce Classic
Use the Visualforce programming language to create targeted and personalized email content.
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 create or change Visualforce email templates: | Customize Application |
| To create or change public email template folders: | Manage Public Classic Email Templates |
-
Choose one of these options.
- If you have permission to edit public templates, from Setup, enter Email Templates in the Quick Find box, then select Classic Email Templates.
- If you don't have permission to edit public templates, go to your personal settings. Enter Templates in the Quick Find box, then select Email Templates or My Templates—whichever one appears.
- Click New Template.
- Choose Visualforce and click Next.
- Choose a folder in which to store the template.
- To make the template available for use, select the Available For Use checkbox.
- Enter an email template name.
- If necessary, change the Template Unique Name. This unique name refers to the component when you use the Lightning Platform API. In managed packages, this unique name prevents naming conflicts in package installations. This name can contain only underscores and alphanumeric characters, and must be unique in your org. It must begin with a letter, not include spaces, not end with an underscore, and not contain two consecutive underscores. With the Template Unique Name field, you can change certain components' names in a managed package and the changes are reflected in a subscriber's organization.
- If desired, choose a different character set from the Encoding dropdown list.
- Enter a description for the template. Both template name and description are for your internal use only.
- Enter a subject line for your template in Email Subject.
- In the Recipient Type dropdown list, select the type of recipient to receive email created from the template.
- If desired, in the Related To Type dropdown list, select the object from which the template retrieves merge field data.
- Click Save.
- On the View and Edit Email Templates in Salesforce Classic page, click Edit Template.
-
Enter markup text for your Visualforce email template.
Note If you are including an image, we recommend uploading it to the Documents tab to reference the copy of the image on our server. For example:<apex:image id="Logo" value="https://yourInstance.salesforce.com/servlet/servlet.ImageServer? id=015D0000000Dpwc&oid=00DD0000000FHaG&lastMod=127057656800" /> - To specify the version of Visualforce and the API used with this email template, click Version Settings. If you’ve installed managed packages from AppExchange , you can also specify which version of each managed package to use with this email template. Generally, use the default value for all versions, to associate the email template with the most recent version of Visualforce, the API, and each managed package. To maintain specific behavior, you can specify an older version of Visualforce and the API. To access components or functionality that differ from the most recent package version, you can specify an older version of a managed package.
- To view the details of the template, click Save. To continue editing your template, click Quick Save. Your Visualforce markup must be valid before you can save your template.
View a sample of the template populated with data from records you choose and send a test email by clicking Send Test and Verify Merge Fields. If the email template includes encrypted data, remember that the data is displayed as encrypted within the generated email and in the Visualforce template page. For security reasons, it isn’t displayed in plain text.
To translate Visualforce email templates based on
recipients’ or related objects’ languages, use the <messaging:emailTemplate> tag's language attribute (valid values: Salesforce supported language keys, for
example, “en-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.
See Also
- Use Merge Fields for Visualforce Email Templates in Salesforce Classic
- Manage Version Settings for Visualforce Email Templates in Salesforce Classic
- Use Visualforce Email Templates with Guest Users
- Modify a Visualforce Email Template for Guest Users
- Create HTML Classic Letterhead Email Templates in Salesforce Classic
- Create Custom HTML Email Templates in Salesforce Classic
- Create Text Email Templates in Salesforce Classic
- Developer's Guide: Visualforce Developer's Guide

