From 7751eb3bf4480c39812e228d84ac2c8e14659dd2 Mon Sep 17 00:00:00 2001 From: bwcx_jzy Date: Sat, 20 Apr 2024 12:07:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20perf(server):=20=E9=82=AE?= =?UTF-8?q?=E7=AE=B1=E6=8A=A5=E8=AD=A6=E5=BF=BD=E7=95=A5=E6=9C=AA=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/org/dromara/jpom/monitor/EmailUtil.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/server/src/main/java/org/dromara/jpom/monitor/EmailUtil.java b/modules/server/src/main/java/org/dromara/jpom/monitor/EmailUtil.java index 5b68b91d2..45fdf6d2a 100644 --- a/modules/server/src/main/java/org/dromara/jpom/monitor/EmailUtil.java +++ b/modules/server/src/main/java/org/dromara/jpom/monitor/EmailUtil.java @@ -9,9 +9,11 @@ */ package org.dromara.jpom.monitor; +import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import cn.keepbx.jpom.plugins.IPlugin; import com.alibaba.fastjson2.JSON; +import lombok.extern.slf4j.Slf4j; import org.dromara.jpom.model.data.MailAccountModel; import org.dromara.jpom.model.data.MonitorModel; import org.dromara.jpom.plugin.PluginFactory; @@ -25,6 +27,7 @@ import java.util.Map; * * @author Arno */ +@Slf4j public class EmailUtil implements INotify { private static SystemParametersServer systemParametersServer; @@ -65,6 +68,10 @@ public class EmailUtil implements INotify { // 没有数据才加载 refreshConfig(); } + if (config == null || StrUtil.isEmpty(config.getHost())) { + log.error("未配置邮箱服务不能发送邮件:{} {}", email, title); + return; + } // Map mailMap = new HashMap<>(10); mailMap.put("toEmail", email);