【发布时间】:2019-05-04 20:02:12
【问题描述】:
我有这个基于 thymeleaf 的电子邮件模板:
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title th:text="#{email.reset.title}">reset title</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body th:style="'background: url(' + |cid:background| + ') no-repeat'">
<div style="margin:110px 0 0 50px;">
<div style="min-width:10px;min-height:300px"></div>
<img style="display:block;margin-top:110px" th:src="|cid:logo|" />
<img style="display:block;margin-top:110px" th:src="|cid:background|" />
</div>
</body>
我已经定义了两个这样的变量:
message.addInline( "logo", new ClassPathResource( "mails/images/logo.png" ), "image/png" );
message.addInline( "background", new ClassPathResource( "mails/images/background.png" ), "image/png" );
img 标签中的两张图片在发送的电子邮件中正确显示,但作为body 背景的相同图片未显示。不知道为什么。
在 java spring 中使用百里香。
【问题讨论】:
-
你有什么解决办法吗?不幸的是,我现在遇到了同样的问题。
-
@Krish 找不到任何简单的东西,所以我放弃了它
-
只有当我在浏览器中登录多个谷歌帐户时,它才在我的情况下工作。它与一个谷歌帐户工作正常。所以我认为这不是我们的错误:)