Create/Edit Email Templates

You can create four different types of email templates.

Text - All users can create or change text email templates. See Creating Text Email Templates.

HTML with letterhead - Administrators and users with the “Edit HTML Templates” permission can create HTML email templates based on a letterhead. See Creating HTML Email Templates.

Custom HTML - Administrators and users with the “Edit HTML Templates” permission can create custom HTML email templates without using a letterhead. You must either know HTML or obtain the HTML code to insert in your email template. See Creating Custom HTML Email Templates.

Visualforce - Administrators and developers can create templates using Visualforce. Visualforce email templates allow for advanced merging with a recipient's data, where the content of a template can contain information from multiple records, see Creating Visualforce Email Templates.

All of these email templates can include text, merge fields, and attached files. You can also Include images on your HTML and Visualforce templates. You can use email templates when you send an email from the Activity History related list of a record. Text and HTML templates can also be used when you send mass email. A button to check the spelling of your template is available for text templates and Visualforce templates without HTML tags.

To Create a Text Email Template

  1. Click Your Name | Setup | Email | My Templates. If you have permission to edit public templates, click Your Name | Setup | Communication Templates | Email Templates.
  2. Click New Template.
  3. Choose the Text template type, and click Next.
  4. Choose a folder in which to store the template.
  5. Select the Available For Use checkbox if you would like this template offered to users when sending an email.
  6. Enter an Email Template Name.
  7. If necessary, change the Template Unique Name. This is a unique name used to refer to the component when using the Force.com API. In managed packages, this unique name prevents naming conflicts on package installations. This name can contain only underscores and alphanumeric characters, and must be unique in your organization. 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, a developer can change certain components' names in a managed package and the changes are reflected in a subscriber's organization.
  8. Select an Encoding setting to determine the character set for the template.
  9. Enter a Description for the template. Both template name and description are for internal use only.
  10. Enter the Subject for the message.
  11. Enter the text to appear in the message.
  12. Optionally, enter merge fields in the template subject and text body. These fields will be replaced with information from your records when you send an email. For details about using merge fields, see Merge Fields Overview.
  13. Click Save.

To Create an HTML Email Template:

Click Your Name | Setup | Email | My Templates. If you have permission to edit public templates, click Your Name | Setup | Communication Templates | Email Templates.

  1. Click New Template.
  2. Choose HTML (using Letterhead) and click Next.
  3. Choose a folder in which to store the template.
  4. Select the Available For Use checkbox if you would like this template offered to users when sending an email.
  5. Enter an Email Template Name.
  6. If necessary, change the Template Unique Name. This is a unique name used to refer to the component when using the Force.com API. In managed packages, this unique name prevents naming conflicts on package installations. This name can contain only underscores and alphanumeric characters, and must be unique in your organization. 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, a developer can change certain components' names in a managed package and the changes are reflected in a subscriber's organization.
  7. Select a Letterhead. The letterhead decides the logo, page color, and text settings of your email.
  8. Select the Email Layout. The email layout determines the columns and page layout of the message text. Click View Email Layout Options to see samples.
  9. Select an Encoding setting to determine the character set for the template.
  10. Enter a Description of the template. Both template name and description are for your internal use only. The description is used as the title of any email activities you log when sending mass email.
  11. Click Next.
  12. Enter the Subject to appear in the email you send.
  13. Enter the text to appear in the message you send. Click any section and begin entering text for your message. To prevent users from editing a section when using this template, click the padlock icon.
  14. Change the style of your text by selecting the text and using the format toolbar. See Using the Format Toolbar for instructions on the format toolbar.
  15. Optionally, enter merge fields in the template subject and body. These fields will be replaced with information from your lead, contact, account, opportunity, case, or solution when you send an email. For details about using merge fields, see Merge Fields Overview.
  16. Click Next.
  17. Optionally, enter the text-only version of your email or click Copy text from HTML version to automatically paste the text from your HTML version without the HTML tags. The text-only version is available to recipients who are unable to view HTML emails. Warning

Salesforce.com recommends that you leave the text-only version blank. If you leave it blank, Salesforce automatically creates the text-only content based on the current HTML version. If you don't leave the text-only version blank and instead manually enter content, subsequent edits to the HTML version aren't reflected in the text-only version.

19. Click Save.

Tip: Click Send Test and Verify Merge Fields to view a sample of the template populated with data from records you choose and send a test email.

Creating Custom HTML Email Templates

  1. Click Your Name | Setup | Email | My Templates. If you have permission to edit public templates, click Your Name | Setup | Communication Templates | Email Templates.
  2. Click New Template.
  3. Choose Custom (without using Letterhead) and click Next.
  4. Choose a folder in which to store the template.
  5. Select the Available For Use checkbox if you would like this template offered to users when sending an email.
  6. Enter an Email Template Name.
  7. If necessary, change the Template Unique Name. This is a unique name used to refer to the component when using the Force.com API. In managed packages, this unique name prevents naming conflicts on package installations. This name can contain only underscores and alphanumeric characters, and must be unique in your organization. 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, a developer can change certain components' names in a managed package and the changes are reflected in a subscriber's organization.
  8. Select an Encoding setting to determine the character set for the template.
  9. Enter a Description of the template. Both template name and description are for your internal use only. The description is used as the title of any email activities you log when sending mass email.
  10. Click Next.
  11. Enter the Subject to appear in the email you send.
  12. Enter the HTML source text to appear in the message you send. This should include all the HTML tags.Note

If you are including an image, we recommend uploading it to the Documents tab so that you can reference the copy of the image that is on our server. For example:

<img src="https://na2.salesforce.com/servlet/servlet.ImageServer?

id=015D0000000Dpwc&oid=00DD0000000FHaG&lastMod=1270576568000" alt="Company Logo"

height="64" width="64"/>

  1. Optionally, enter merge fields in the template subject and body. These fields will be replaced with information from your lead, contact, account, opportunity, case, or solution when you send an email. For details about using merge fields, see Merge Fields Overview.
  2. Click Next.
  3. Optionally, enter the text-only version of your email or click Copy text from HTML version to automatically paste the text from your HTML version without the HTML tags. The text-only version is available to recipients who are unable to view HTML emails. Warning

Salesforce.com recommends that you leave the text-only version blank. If you leave it blank, Salesforce automatically creates the text-only content based on the current HTML version. If you don't leave the text-only version blank and instead manually enter content, subsequent edits to the HTML version aren't reflected in the text-only version.

4.   Click Save.

Tip:  Click Send Test and Verify Merge Fields to view a sample of the template populated with data from records you choose and send a test email.

Note

Users cannot modify the content of a custom HTML template when they select it for use in an email.

Include images on your HTML and Visualforce templates

You can include images or logos on your HTML and Visualforce email templates. For HTML with letterhead templates, logos or images come from the letterhead you choose when creating the template.

When creating custom HTML or Visualforce templates, simply include img tags that reference the image.

** Salesforce recommends uploading the images to the Documents tab and referencing the copy of the image on the Salesforce server.

For example, for HTML:

<img src="https://na2.salesforce.com/servlet/servlet.ImageServer?

id=015D0000000Dpwc&oid=00DD0000000FHaG&lastMod=1270576568000" alt="Company Logo"

height="64" width="64"/>

Visualforce example:

<apex:image id="Logo" value="https://na7.salesforce.com/servlet/servlet.ImageServer?

id=015D0000000Dpwc&oid=00DD0000000FHaG&lastMod=127057656800"

height="64" width="64"/>

Editing Email Templates

To edit your personal email templates, click Your Name | Setup | Email | My Templates.

If you have permission to manage public email templates, click Your Name | Setup | Communication Templates | Email Templates.

  • Click on the name of any email template to go to the Viewing Email Templates page.
  • To edit or delete a template, click Edit or Del next to the template name in the list.