java - 使用速度模板格式化电子邮件正文?

标签 java css spring velocity

我正在使用 velocity 模板来格式化邮件正文。我有以下文件。

示例.vm

<html>
<body>

This is an error email<p/>  //This text should be in bold

${exceptionDetails} //This exception details should be in RED font.

</body>
</html>

如何将文本设置为粗体并将异常详细信息设置为红色?

请帮帮我。

谢谢!

最佳答案

您应该使用样式声明来实现这一点。

像这样:

<html>
<body>
<span style="font-weight:bold">
This is an error email<p/>  //This text should be in bold
</span>
<span style="color:red">
${exceptionDetails} //This exception details should be in RED font.
</span>
</body>
</html>

您可以阅读更多相关信息 here .

When you're coding an HTML email with CSS, make sure that you don't use linked CSS files (.css files attached using link or @import). These are the stylesheets most widely ignored by email clients.

.....

关于java - 使用速度模板格式化电子邮件正文?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19496755/

相关文章:

java - 使用 @Autowired 进行 Spring 对象注入(inject)时抛出 NullPointerException

java - 从 Maven 插件执行 "Export Studio Documentation"

html - 自定义嵌套有序列表编号

java - 日历 API 调用开始产生 "SSL peer shut down"

html - div 内的中心菜单

javascript - 如何使用 html 和 javascript 创建复制按钮?

java - Spring - server.connection-timeout 不起作用

java - 用户名和密码未与 Spring 中的身份验证映射

java - 调用未 stub 的方法时抛出 RuntimeException

java - 使用 Feign 和 Jackson 将对象序列化为 x-www-form-urlencoded