Search code examples
javavelocityapache-commonssap-commerce-cloudemail-templates

SAP Hybris email velocity template image reference


I have .vm file for confirmation order mail and I'm placing some informations to this .vm template. There are several images in these informations. But my images not rendered while the email was sending. I tried several methods but doesn't work.These are:

<img src='${ctx.contextPath}/images/theme/social_01.jpg

<img src='${ctx.themeResourceUrl}/images/theme/social_01.jpg

and

<img src='../images/theme/social_01.jpg

Any one of these are didn't work for me.

Also my images at the following location of the project:

xxxStore > import > sampledata > contentCatalogxxx > images > theme >

How can I solve this problem ?


Solution

  • Can you print the complete image URL in the email and try to open it in the new browser window and see. You should able to access your image. If not, try looking at the URL, is it correct? Let me know the result.

    I would suggest you to following any exiting working image, place your image to the same folder, and access it similarly.


    It seems you are trying to access static image. You can find all frontend static content under the webroot folder of the storefront extension. Your image should be in the same folder as well.

    e.g. I have an image at

    sastorefront/web/webroot/_ui/responsive/theme-blue/images/test.png
    

    I can access it using

    ${themeResourcePath}/images/test.png
    

    To debug path issues, I would print the path, and try hitting same URL through the browse. Ideally, an image should be accessible with the URL. Say in my case, I can access test.png with

    https://example.com/_ui/responsive/theme-blue/images/test.png