使用JHipster和Thymeleaf发送带有图像的电子邮件 [英] Send email with images using JHipster and Thymeleaf

查看:127
本文介绍了使用JHipster和Thymeleaf发送带有图像的电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在JHipster项目中使用图像,但是Thymeleaf无法识别图像在我的JHipster项目中的位置.

我的图像位于以下文件夹中:* C:\ PATH \ src \ main \ webapp \ content \ img_email *,而我的HTML模板位于:* C:\ PATH \ src \ main \ resources \ mails *.

我尝试了以下组合,例如 src ="../../content/img_email/logo-5asec.jpg" ,甚至尝试使用符号 th:src ="@ {〜/PATH/img_email/logo-5asec.jpg}".我什至试图更改图像文件夹的位置都没有成功.

解决方案

您必须为图片使用完整的网址(例如, http://my.domain.org/content/images/something.png ),否则邮件客户端不知道从何处下载它们.

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.

解决方案

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.

这篇关于使用JHipster和Thymeleaf发送带有图像的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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