Thymeleaf - 无法在电子邮件中添加徽标 [英] Thymeleaf-Unable to add a logo to the email
问题描述
我对thymeleaf和jhipster是新手,目前我正在研究一种带有百里香叶的电子邮件模板。我需要在电子邮件中添加徽标图像。我尝试了很多方法,但我很困惑在哪里保存图像以及如何将其添加到电子邮件的html模板中。
th:src = @ {/ logo.png} - 我使用了这个标签,我的图片在
project-web-app \src\main\webapp\logo.png中。
图像的来源应该指向一个绝对的URL,并且可以通过邮件阅读器访问主机名。 b
$ b
在JHipster 3中,该URL可以在 jhipster.mail.base-c中的
属性。您可以在 application * .yml
url src / main / resources / mails / activationEmail.html
中使用注册链接。
在你的情况下,你的模板应该像这样引用你的图片: th:src =@ {| $ {baseUrl} /logo.png |}
。
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.
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|}"
.
这篇关于Thymeleaf - 无法在电子邮件中添加徽标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!