1

I am looking to load the header and footer images present in the Document tab When I click on the URL: https://c.cs53.content.force.com/servlet/servlet.ImageServer?id=0150j000000DHQL&oid=00D0j000000CrDy&lastMod=1490844866000, I see the image opens up. Now the same image I want to open it in the VF Email Template, so I write the following logic but it did not get worked why ??

<messaging:emailTemplate subject="Case Description - {!relatedTo.Description}" recipientType="User" relatedToType="Case">
    <apex:image id="Logo" value="https://c.cs53.content.force.com/servlet/servlet.ImageServer?id=0150j000000DHQL&oid=00D0j000000CrDy&lastMod=1490844866000" />
    <messaging:htmlEmailBody >

    </messaging:htmlEmailBody>

</messaging:emailTemplate>

What is the best way to load images (as a header and footer) in VF Email Template ?

UPDATE-1::

I have loaded the image but its getting break. Why ? Please guide.

I used both image as jpg and its broken .Please guide

enter image description here

The code I used

<messaging:emailTemplate subject="Case Description - {!relatedTo.Description}" recipientType="User" relatedToType="Case">

    <messaging:htmlEmailBody >
        <apex:image value="{!URLfor($Resource.HeaderFooter, 'HeaderFooter/abc.jpg')}"/>
        <apex:image value="{!URLfor($Resource.HeaderFooter, 'HeaderFooter/xyz.jpg')}"/>
    </messaging:htmlEmailBody>

</messaging:emailTemplate>
  • Now I loaded all images as static resources and still its not being showing in preview. Please guide – user4567570 May 2 '17 at 4:08
0

As mentioned in the docs

  1. Add an image to the Documents tab.
  2. On the Documents home page, open the image by clicking its name.
  3. Right-click the image and get its reusable URL address. When you use the URL, you reference the copy of the image on the Salesforce server.
  4. Open your custom HTML or Visualforce template.
  5. Place the HTML tag , using the image’s URL address, where you want to insert the image in the email template.

Example

<apex:image id="Logo" value="https://yourInstance.salesforce.com/servlet/servlet.ImageServer?
id=015D0000000Dpwc&oid=00DD0000000FHaG&lastMod=127057656800" />

You can also use an external image using the absolute URL

<img src="http://www.401khelpcenter.com/syndicate/img/AF-Logo_Brown_Small.gif" alt="Logo"/>

  • I did exactly the same already, but I dont see the image is getting previewed in VF Email Template. Is there any special tag do we need ti used ? – user4567570 May 1 '17 at 19:30
  • Where did you place your image in salesforce? – Mahmood May 1 '17 at 20:03
  • Its in the Document tab. I did right click on image and "copy email address", but not sure why its not working ? – user4567570 May 2 '17 at 3:50
  • sometimes, in the email it will show as an icon so you need to download the image on the email body upon right clicking it. I am talking about actual email here, not the email template – Santanu Boral May 2 '17 at 4:06
  • Please see update-1 in above post ! – user4567570 May 2 '17 at 4:18

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.