Thymeleaf-无法在电子邮件中添加徽标 [英] Thymeleaf-Unable to add a logo to email

查看:69
本文介绍了Thymeleaf-无法在电子邮件中添加徽标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在与Thymeleaf和JHipster一起设计电子邮件模板.我正在尝试添加徽标图像.我尝试了许多方法,但是我对如何保存图像以及如何将其添加到电子邮件的html模板感到困惑. 我使用了th:src=@{/logo.png}标签,并且图像位于project-web-app\src\main\webapp\logo.png内部.

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.

推荐答案

图片来源应指向邮件阅读器可以访问的具有主机名的绝对URL.

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

在JHipster中,可以在jhipster.mail.base-url属性的application*.yml中配置此URL.您可以在src/main/resources/templates/mail/activationEmail.html中看到它用于注册链接.

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.

在您的情况下,您的模板应引用您的图片,如下所示:th:src="@{|${baseUrl}/logo.png|}".

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

这篇关于Thymeleaf-无法在电子邮件中添加徽标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆