I'm currently working on an email template with Thymeleaf and JHipster. I'm trying to add a logo image. I tried many methods, but I'm confused, where to save images and how to add them to html template of the email.
I used th:src=@{/logo.png}
tag and my images are located inside project-web-app\src\main\webapp\logo.png
.
The source of your image should point to an absolute URL with hostname that can be reached by mail reader.
In JHipster, this URL can be configured in application*.yml
in jhipster.mail.base-url
property. You can see it being used in src/main/resources/templates/mail/activationEmail.html
for registration link.
In your case, your template should refer to your image like this: th:src="@{|${baseUrl}/logo.png|}"
.