Thymeleaf-Unable to add a logo to the email

限于喜欢 提交于 2020-01-15 08:12:53

问题


I am new to thymeleaf and jhipster, I'm currently working on an email template with thymeleaf. I need to add a logo image into the email. I tried many methods but I'm confused where to save images and how to add then into the html template of email. th:src=@{/logo.png} - I used this tag and my image are inside project-web-app\src\main\webapp\logo.png.


回答1:


The source of your image should point to an absolute URL with hostname that can be reached by mail reader.

In JHipster 3, this URL can be configured in application*.yml in jhipster.mail.base-url property. You can see it being used in src/main/resources/mails/activationEmail.html for registration link.

In your case, your template should refer to your image like this: th:src="@{|${baseUrl}/logo.png|}".



来源:https://stackoverflow.com/questions/41867321/thymeleaf-unable-to-add-a-logo-to-the-email

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!