When you send an email from Salesforce, such as when you use the Send Email button or triggered from a workflow, you can select an email template. Email Templates in Salesforce come in four different types:
- Plain Text
- HTML using Letterhead
- HTML Custom
Plain Text Email Template
This is the simplest email template to create. You can create it very quickly by entering the email text and including the merge fields that you would like to use. Although this kind of template is easy to create, it does not allow images to be included and tracking of if the email was opened, which is available with the other types. Often a text email template is used as a notification to internal users, as branding and tracking is not so important.
In the example above, an email template has been created to notify of a case assignment. Merge fields for the case number and case subject have been used in the subject, and a number of merge fields selected to be included in the email body. When the email is sent, data from the related record is used to populate the merge fields.
HTML using Letterhead
The next step up from a plain text is to create an HTML using Letterhead template. The email sent is formatted using HTML but you don’t need to know HTML to create one. You define a letterhead, and then format text and merge fields into the email body.
The example above shows a HTML letterhead template with its various sections. At the top is the header where you can insert a company logo and set the background color. Then there is the email body, where you can again set the background color and insert text and merge fields. Finally there is the footer where you can insert a different logo and set the color. The letterhead is predefined and can be reused as the basis for your template, and then the text and merge fields added. Formatting controls are available to customize the look of the text. The advantage of using this kind of template is that you get a professional looking email branded with your logos, background colors and formatted text without needing to know any HTML or CSS.
Use custom HTML templates when you have HTML skills and want to have total control over the look of the email. You can enter html, including images (remember the images will be hosted by Salesforce and so you must load them into the documents folder and then carefully construct the image URL).
Visualforce Email Templates
Visualforce email templates are used when you need total control of not only the presentation of the email but the data as well. With Visualforce email templates you can:
- Define CSS styles that will apply to the HTML tags within the email
- Use Visualforce to include a set of records in the email (e.g. all cases related to an account)
- Use a custom controller to retrieve specific data for use in the email
- Use Visualforce tags to create attachments that include related data
What Certification are you studying for now?
Focus on Force currently provides practice exams and study guides for fifteen certifications