how to add hyperlinks to image/Icons in email templates?

I have tried using Formula field.


HyperLink("www.google.com",Image("/resource/image/googleIcon.png","Google"), "google")

The hyperlinks are working properly but the images are not rendering.

enter image description here


Try this.

In your <messaging:htmlEmailBody> tag, create a html body tag and use hyperlink tag.

<a href="www.google.com"><img src="/resource/image/googleIcon.png"></a>

And also make sure you have an image in /resource/image/googleIcon.png. Or else you can use Static resource.

  • Thanks for the answer. But i am not using Visualforce email template. I am using HTML template with letter head – Rahul rvj May 5 '15 at 12:23
  • can we use CSS properties in VF templates like padding? if yes where do we need to give the <style> tag in <messaging:htmlEmailBody> > – Rahul rvj May 5 '15 at 15:25

I think this is what you are looking for


  • This is just to insert an Image. What i need is adding Hyperlinks to those images which directly has no way to give hyperlinks to them. So got a workaround by formula field. But when using formula field it is not rendering the image in Email template. – Rahul rvj May 5 '15 at 14:06
  • What do you mean by "images which directly has no way to give hyperlinks to them" – Jaguar May 5 '15 at 14:20
  • In HTML letterhead type email templates, we can give hyper links to any text just by just selecting the text area and clicking a link button at the top of the html letterhead template in salesforce. But where as for images, you can add images by clicking an image button at the top and selecting an image from documents which will display the image on the template directly with out any formula or tag. But my requirement is to giving hyperlinks to those images which is not possible as we can give to normal text in HTML letterHead email templates. – Rahul rvj May 5 '15 at 15:21

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.