I am currently trying to create a Welcome Email for SF Community. The email includes an image stored in Static Resources (Cache-control = public).

When I tested initially using "Send Email and Verify Merge Fields", the image does shows up in the email. However, when I trigger the email through community (through adding new profiles), the image does not show up in the email. This is true for Gmail and Outlook.

I inspected the image source in gmail but the URL/src looks identical in both cases with the exception that gmail caches the image on a different CDN for each email. I did notice that, in Outlook, there are two attributes (src="" and originalsrc=<correct image src/url>) when triggered through community.

Also, when sent via "Send Email and Verify Merge Fields", the sender is the System Administrator. When triggered through community, the sender is an email setup in the Community Workspace.

  • 1
    You should store your image in document instead + check the flag 'available fir external...'
    – Liron C
    Nov 13, 2020 at 18:51
  • @LironC, if I do that, it wouldnt be ideal to deploy the images + code from one environment to another. I'm also curious why it would work when I use "Send Email and Verify Merge Fields".
    – sf_dev
    Nov 13, 2020 at 18:59
  • You right. But you can do smart code that will constrcut the document url based on the image name, this way it will work the same in any org.... Not sure if it working for you in the sf preview or you actually recieve email with the image, but basically the image url in static resource is secure and external user cannot access it
    – Liron C
    Nov 13, 2020 at 19:18
  • Gotcha, thanks for the explanation! Emails sent from "Send Email and Verify Merge Fields" do have the image loaded in gmail/outlook. So even with cache-control ='public', it wouldn't work for external users?
    – sf_dev
    Nov 13, 2020 at 19:34
  • From my experience it won't work. Not sure why it is working from the test button. If you will take the static resource url and paste it in browser incognito mode you will not be able to access it
    – Liron C
    Nov 13, 2020 at 19:44

2 Answers 2


When you use "Send Email and Verify Merge Fields" it accesses the image using the System Administrator privileges, so obviously you can see the image in the email.
When you are redirected to the login page that's because you don't have permission to view the image, or a record related to the image.
In general, images in Community, like many secure things in Community recently, is a mess.

The best solution we found was to create a Visualforce Template for the email, and embed the image there. That works, even when the Community user is the one sending the email (triggered by them on registering).
I'm not 100% sure that we deploy it with everything else (via ANT) but I think we do.

Also gonna reiterate what @Liron C said in the comments: using a ContentDocument is your best bet. Yes you can't deploy it, but how often do you need to deploy an image for an email? Create it once in the target org, then deploy your code as usual.

  • I don't think he need to use contentDocument object - this one is when using Files. If the image will be stored in document folder, then it simply Document object.
    – Liron C
    Nov 16, 2020 at 17:13

Thank you @AvailableName and @LironC for your explanations. Helped me understand why the issue happened.

I ended up implementing the solution suggested by @LironC


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.