Search code examples
emailsalesforceapexvisualforce

How can I make the images in the email template to show in every client?


The images embedded in the body of a Visualforce email template don't show in all the clients.

I am not sure where to start. I've tried to set the tag to <apex:image/> and <img />.
Tried to use URLFOR($Resource.Static) in the value attribute.
Tried to copy/paste the image server link.

I expect that the images in the body show in every client.
So far all the images are replaced by the alt attributes or just a blue border.


Solution

  • alt's might be there because client is not trusting SF and you need to explicitly allow downloading images, asking your recipients to add you to safe senders list etc.

    But that's not all. Static resources are served from generic domain. There's nothing really tying them to given org (even if it has MyDomain enabled). They rely on your cookies for redirect to right org's resources and don't work well in email templates or VF pages set to renderAs="pdf".

    You should use old-school Documents (if you're in Lightning UI - flip back to Classic), upload your stuff there, make sure "externally available image" checkbox is ticked...

    Or in Files I think you can set deliveries, build the direct download URL too that should work OK (look for something with "shepherd" in URL, I know it sounds stupid)