Pages

Saturday, May 10, 2014

Salesforce: Create HTML email template

Using Salesforce.com, you can define your own email template. There are a few type of email template in Salesforce: Text, HTML (using Letterhead), Custom (without using Letterhead) and Visualforce.

HTML (using Letterhead) provide easy way to create email template, where you need to build a letterhead prior. You can edit background colour, logo, header colour, body colour, footer and etc. But, you have limited flexibility to modify email template using this option.

Custom (without using Letterhead) give you more flexibility to design your own email template, but you need to have technical knowledge with HTML. You can use HTML editor such as: CoffeeCup or online HTML editor, such as: quackit to help.

But, if you have Ms Word and familiar with Ms Word, you can utilize it. Type and beautify your content in Ms Word with font style and etc.
- Save it as Web Page, Filtered (*.htm;*.html)
- Open the html file save using any text editor, example: Notepad
- Copy the whole HTML and paste it to HTML Body in Salesforce email template
- Done.

If you have images for email template, you can reference upload the images to any site as long as reachable from internet, or upload them into Salesforce Document, make sure to set the images as Externally Available, then copy and paste image URL for your email template.

In summary:
1. Upload images to Document and set as Externally Available, right click the image, if you are using Google Chrome, click "Open image in new tab"

2. Create Email Template
Go to Setup - Administer - Communication Templates - Email Templates
select Custom (without using Letterhead)
Copy and paste HTML prepared, example:
<table>
<tr>
<td colspan=3>
<img src="https://c.na3.content.force.com/servlet/servlet.ImageServer?id=015300000000tX5&oid=00D300000000SHq" alt="Logo" height="42" width="82"/></td>
</tr>
<tr>
<td>Name </td>
<td>{!Contact.FirstName}</td>
<td><b>{!Contact.LastName}</b></td>
</tr>
</table>

If you notice in markup above, it refer to image stored in Salesforce document in line 4, while merge field in line 8 and 9 for Contact First Name and Last Name.

Once saved, you can preview in HTML Preview panel and test send email from Send Test and Verify Merge Fields button.


1 comment: