Search code examples
javaspring-bootthymeleafjhipster

Send email with images using JHipster and Thymeleaf


I'm trying to use images in my JHipster project, but Thymeleaf can't identify the location of the images in my JHipster project.

My images are located in this folder: *C:\PATH\src\main\webapp\content\img_email* and my HTML templates in: *C:\PATH\src\main\resources\mails*.

I tried following combinations such as src="../../content/img_email/logo-5asec.jpg" and even tried to use the notation th:src="@{~/PATH/img_email/logo-5asec.jpg}". I even tried to change the images folder location without success.


Solution

  • You must use full URLs for your images (e.g.http://my.domain.org/content/images/something.png) in e-mail messages otherwise a mail client has no idea where to download them from.