首页 > 解决方案 > 如何在没有模板文件的情况下使用 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 电子邮件呢?

标签: htmlspring-bootjakarta-mailhtml-emailozimov-email-tools

解决方案


推荐阅读