diff --git a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MailServiceImpl.java b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MailServiceImpl.java index 4e91ea73d6f..ec627f81548 100644 --- a/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MailServiceImpl.java +++ b/manager/src/main/java/org/apache/hertzbeat/manager/service/impl/MailServiceImpl.java @@ -18,6 +18,7 @@ package org.apache.hertzbeat.manager.service.impl; import freemarker.cache.StringTemplateLoader; +import freemarker.core.TemplateClassResolver; import freemarker.template.Configuration; import freemarker.template.TemplateException; import java.io.IOException; @@ -99,6 +100,7 @@ public String buildAlertHtmlTemplate(final Alert alert, NoticeTemplate noticeTem String templateName = "mailTemplate"; stringLoader.putTemplate(templateName, noticeTemplate.getContent()); cfg.setTemplateLoader(stringLoader); + cfg.setNewBuiltinClassResolver(TemplateClassResolver.SAFER_RESOLVER); templateMail = cfg.getTemplate(templateName, Locale.CHINESE); return FreeMarkerTemplateUtils.processTemplateIntoString(templateMail, model); }