【发布时间】:2019-06-22 08:39:16
【问题描述】:
我想以文本形式在电子邮件中发送 html 内容,并希望将一些变量绑定到该 html 内容中。这个 html 内容保存在我用来发送电子邮件的数据库中。所以我想使用接受模板名称和上下文变量的SpringTemplateEngine 的处理方法。但我有 html 内容而不是模板。我想为此使用百里香模板引擎。但我不明白如何转换 html 内容,例如:
<html>
<head></head>
<title></title>
<body>
<div>
<p>Your ${value1} for ${value2}</p>
</div
</body>
使用以下方法到百里香模板:
String mailTemplate = templateEngine.process("mailTemplate", context);
请有人帮我解决这个问题。
【问题讨论】:
标签: spring-boot thymeleaf