I want to use custom labels in the email template to display images stored in the documents.

I want to store the base URl and Ids in a label so that I can fix them on moving them to other sandboxes.

  • What is the type of your email template? Is it a VF template? – manjit5190 Oct 14 '15 at 19:39
  • 2
    Only VF templates can have CL. – Ashwani Oct 15 '15 at 6:52
  • It is an HTML template. – Keepcalmncode Oct 15 '15 at 20:23

Use below syntax to get the custom label in the Email Template, Please remember to enclose the syntax with single quote(').

| improve this answer | |
  • I don't know why this answer is down-voted. Perhaps it didn't work in 2016? But it does work now. You can use {!$Label.LabelName} in text/html classic email templates in Winter 19 – Aidan Jan 31 '19 at 17:13
  • Was able to use the label without the single quote in the subject line. Thanks for the tip! – Jason Hardy Mar 7 '19 at 19:41
  • unable to use {!$Label.LabelName}' with or without quotes in body of classic email template – C0DEPirate Mar 26 '19 at 15:37
  • I can't get the label to work in the body of the email by itself. It does work in the subject and it does work in the URL of a link merge field. But whenever I use it by itself in the body the merge field gets replaced with blank text. I tried with and without the single quotes. – andynormancx Sep 3 '19 at 8:47

You have to use VisualForce HTML template. Here's how to use it:

Suppose in the template, the Billing Address is written as follows:

<apex:variable var="billingAddress" value="Billing Address" />

To use the label change this to:

<apex:variable var="billingAddress" value="{!$Label.BillingAddress}"/>

As another example, you can change a literal value within the Visualforce markup like this:

<td>My Label</td>

To use a created label called MyLabel, instead of a literal, change this to:


And this should work fine!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.