function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nagalakshminagalakshmi 

issue with static resource

Hi,

 

 

I have a static resource with image. I am trying to display one email template with this static resource image. But i am unable to get the image in to my inbox. Please help me out how to solve this.

 

 

Thanks,

Laskhmi

Avidev9Avidev9
Make sure the template is HTML. And also make sure the Static Resource is marked public.
nagalakshminagalakshmi

Hi Avi,

 

I did both what you said.. but still i am facing same problem..

Michael_TorchedloMichael_Torchedlo
from Force.com help site:  
 
Why images stored as static resources cannot be seen in emails sent using VF email templates?
Knowledge Article Number: 000003730


Description

I have uploaded a few images in static resources. When I am including these images in a VF page email template, the image doesn't show up in the email. Instead a 'X' mark comes up.

This is the mark up I am using to include static resources:

<apex:image id="theImage" value="{!$Resource.myResourceImage}" width="200" height="200"/>
<apex:image url="{!URLFOR(!$Resource.TestZip, 'images/Bluehills.jpg')}" width="50" height="50" />




Resolution

The reason why the image doesn't show up in the email is because value="{!$Resource.myResourceImage}" generates a relative URL from which the image is rendered (i.e. "/resource/1312483024000/logo"). This URL is accessible only for authenticated platform users.

Also, when we store images as static resources, the field "Cache Control" = "Public" specifies that the static resource data cached on the Salesforce server be shared **with other users in your organization** for faster load times. Setting it "Public" will not allow it to be accessible outside salesforce Org.

To solve this problem, images should be stored in documents and with "Externally Available Image" checked. The image will be available by using the following markup:

<apex:image id="theImage" value="https://c.<instance>.content.force.com/servlet/servlet.ImageServer?id=<document_id>&oid=<organization_id>" width="200" height="200"/>

 

 

CoolSurenCoolSuren

Hi,

 

 Just store your image in to the Document instead of static resource, then you can access it in email template.