Loading

Static resources images are missing in emails from Salesforce

Udgivelsesdato: May 23, 2026
Beskrivelse

When including images from Salesforce Static Resources in a Visualforce email template using ``, the image may not display in the email recipient's client. Instead, a broken image indicator — an 'X' mark — appears in the email.
For example, the following Visualforce markup generates a relative URL that is only accessible to authenticated Salesforce users — not external email recipients:

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

The expression {!$Resource.myResourceImage} generates a relative URL such as /resource/1312483024000/logo. This URL is accessible only within an authenticated Salesforce session.

Løsning

Why This Occurs

Static Resource URLs generated by {!$Resource.myResourceImage} are relative URLs, accessible only to authenticated platform users. Even setting the Cache Control field on a Static Resource to "Public" only makes the resource accessible within your Salesforce org — it does not make the image available to external email recipients.

Fix: Use Salesforce Documents Instead

To display images in email sent from Visualforce templates, store the image as a Salesforce Document (not a Static Resource) and check the Externally Available Image checkbox on the Document record.
Once the Document is marked as externally available, reference it in your Visualforce template using the following markup (

Why This Occurs

Static Resource URLs generated by {!$Resource.myResourceImage} are relative URLs, accessible only to authenticated platform users. Even setting the Cache Control field on a Static Resource to "Public" only makes the resource accessible within your Salesforce org — it does not make the image available to external email recipients.

Fix: Use Salesforce Documents Instead

To display images in email sent from Visualforce templates, store the image as a Salesforce Document (not a Static Resource) and check the Externally Available Image checkbox on the Document record.
Once the Document is marked as externally available, reference it in your Visualforce template 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"/>
Vidensartikelnummer

000384817

 
Indlæser
Salesforce Help | Article