0

I have an email template defined in salesforce which uses custom components. Eveything works fine. But i am also showing chatter image of the lead owner i.e user.

<img src="{!leadOwner.FullPhotoUrl}"  width="58" height="58" align="middle" />

which generates

<img align="middle" alt="alex" height="58" src="https://c.cs5.content.force.com/profilephoto/729O00000004Gjz/F" width="58">

Problem is the Gmail do not show this image.

Failed to load resource: the server responded with a status of 404 (Not Found) https://ci5.googleusercontent.com/proxy/zOByJ58s8uRZn-AfYwBUlicwnihwa9s39sV…=s0-d-e1-ft#https://c.cs5.content.force.com/profilephoto/729O00000004Gju/F

Images not showing up in Email sent using email template Have seen this link but this works only with documents can we do it for chatter profile image too.

Also, i would like to know if there is a way to implement view online option for my email so that regardless of what clients browser/mail provider supports, i can gracefuly show my content.

4
  • 1
    I don't think you can access chatter photo outside salesforce with a direct url.. c.cs5.content.force.com/profilephoto/729O00000004Gjz/F will work only within salesforce :-( Commented Aug 12, 2014 at 13:22
  • Ok this mean i am able to view the image only because i am logged in. Commented Aug 12, 2014 at 13:38
  • 4
    If you are willing to go to a lot of trouble, you can replicate the Blob data from the FullPhotoUrl (via a trigger on User) as an "Externally Available Image" document and save the document's public URL in a new field on User called e.g. ExternallyAvailableFullPhotoUrl__c that you can reference in your email templates.
    – Keith C
    Commented Aug 12, 2014 at 13:42
  • Thanks Keith this looks promising. How about view online option. do you have any idea? Commented Aug 12, 2014 at 13:48

1 Answer 1

1

If you use either Chatter in Apex or the Chatter REST API, you can retrieve image URLs that can be used in email messages. They're temporary and expire after 30 days.

Chatter in Apex:

ConnectApi.ChatterUsers.getPhoto(String communityId, String userId) returns a ConnectApi.Photo object that contains fullEmailPhotoUrl and standardEmail​PhotoUrl properties.

Chatter REST API:

GET /chatter/users/userId returns a Photo representation that also contains the fullEmailPhotoUrl and standardEmail​PhotoUrl properties.

You must log in to answer this question.

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