html - 如何在没有模板文件的情况下使用 Ozimov Spring Boot 电子邮件工具发送 HTML 电子邮件?
问题描述
我想在 ozimov spring boot 电子邮件工具中发送没有任何模板的 HTML 电子邮件。当我尝试像这样使用 DefaultEmail 时:
final Email email = DefaultEmail.builder()
.from(new InternetAddress("anyone@example.com", "Anyone"))
.to(Lists.newArrayList(managerMailAddress)).subject("Test")
.body(mailBody).encoding("UTF-8").build();
但这很糟糕。发送此邮件时,所有 html 标记都会显示在邮件中。那么如何发送 HTML 电子邮件呢?
解决方案
推荐阅读
- r - 根据多行/列中的分组匹配过滤行
- python - 使用 zipfile 解压后文件权限丢失
- sql - SQL 良好实践:我应该在这个例子中使用关联表吗?
- spring - sec:authorize from thymeleaf 可以用于多个角色吗
- java - Java如何以毫秒为单位获得未来的具体点?
- xamarin - 从 xamarin MVVM 中的 SfRadioButton 获取选定值
- html - 按下回车后如何清空输入字段?
- python - 在 Python3 中,如何导航异常和异常链以打印更有用的错误消息
- angular - 从 Angular 7 升级到 12
- c++ - 如何从中央小部件类更新 MainWindow 中的状态栏?