3

I have many images in document tab and all are externally available. When I try to add the image in HTML & VF email template, the images look broken in outlook when its received.

enter image description here

I thinks thats a minor error that's causing this. Any help is appreciated.

<messaging:emailTemplate subject="Details -" recipientType="User" relatedToType="Evaluation__c">
<messaging:plainTextEmailBody>

    Congratulations! This is your new Visualforce Email Template. Hello, Sample Image below: <br/>
    <apex:image url="https://aec.cs51.content.force.com/servlet/servlet.FileDownload?file=0254B0000000WmD" />

</messaging:plainTextEmailBody>
</messaging:emailTemplate>

Note: When the url is opened in different browser, it requires login.

4
  • this link might be helpful for adding an image from a document tab success.salesforce.com/answers?id=90630000000gq6EAAQ help.salesforce.com/apex/…
    – Amit Jain
    May 12, 2016 at 7:36
  • Trying. Meanwhile, is it ok for images in any folder? Or it must be in the shared documents folder?
    – Viraj
    May 12, 2016 at 7:41
  • There should be a Documents tab in your Salesforce.com org. If not select the + at the right of the tabs and select the Documents link. Upload you image to a folder of choice (be sure not to upload to Personal Folder)
    – Amit Jain
    May 12, 2016 at 7:44
  • @AmitJain it can be in personal folder
    – Himanshu
    May 12, 2016 at 7:48

2 Answers 2

5

open document tab,and image what u want to display,right click on image copy and paste it in <apex:image >

<messaging:emailTemplate subject="vf template" recipientType="Contact" >   
   <messaging:plainTextEmailBody >
    Congratulations! This is your new Visualforce Email Template. 
    <apex:image url="sahitya0907-dev-ed--c.ap2.content.force.com/servlet/…; /> 
</messaging:plainTextEmailBody> </messaging:emailTemplate> 
1
  • 1
    <messaging:emailTemplate subject="vf template" recipientType="Contact" > <messaging:plainTextEmailBody > Congratulations! This is your new Visualforce Email Template. <apex:image url="sahitya0907-dev-ed--c.ap2.content.force.com/servlet/…" /> </messaging:plainTextEmailBody> </messaging:emailTemplate>
    – Satya
    May 12, 2016 at 9:02
4

You need to pass organization id while referring externally available image in your email document and url is also bit different which you use while referring the document.

<messaging:emailTemplate subject="Details -" recipientType="User" relatedToType="Evaluation__c">
<messaging:plainTextEmailBody>

    Congratulations! This is your new Visualforce Email Template. Hello, Sample Image below: <br/>
    <apex:image
    url="https://aec.cs51.content.force.com/servlet/servlet.ImageServer?id=0254B0000000WmD&oid=YOURORGID" />

</messaging:plainTextEmailBody>
</messaging:emailTemplate>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .