diff --git a/servers/boe-server-all/pom.xml b/servers/boe-server-all/pom.xml
index 2c185edb..214bdaff 100644
--- a/servers/boe-server-all/pom.xml
+++ b/servers/boe-server-all/pom.xml
@@ -171,6 +171,11 @@
javax.mail-api
1.5.6
+
+ com.sun.mail
+ javax.mail
+ 1.5.6
+
org.apache.commons
diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/assistance/service/ISmtpEmailService.java b/servers/boe-server-all/src/main/java/com/xboe/module/assistance/service/ISmtpEmailService.java
new file mode 100644
index 00000000..91ad7f4b
--- /dev/null
+++ b/servers/boe-server-all/src/main/java/com/xboe/module/assistance/service/ISmtpEmailService.java
@@ -0,0 +1,17 @@
+package com.xboe.module.assistance.service;
+
+/**
+ * SMTP邮件服务接口
+ */
+public interface ISmtpEmailService extends IEmailService {
+
+ /**
+ * 使用SMTP直接发送邮件
+ * @param to 收件人邮箱
+ * @param subject 邮件主题
+ * @param htmlMsg 邮件内容(HTML格式)
+ * @param from 发件人邮箱
+ * @throws Exception 发送异常
+ */
+ void sendMailBySmtp(String to, String subject, String htmlMsg, String from) throws Exception;
+}
\ No newline at end of file
diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/assistance/service/impl/SmtpEmailServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/module/assistance/service/impl/SmtpEmailServiceImpl.java
new file mode 100644
index 00000000..1f9f2cac
--- /dev/null
+++ b/servers/boe-server-all/src/main/java/com/xboe/module/assistance/service/impl/SmtpEmailServiceImpl.java
@@ -0,0 +1,94 @@
+package com.xboe.module.assistance.service.impl;
+
+import java.util.Properties;
+
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import com.xboe.module.assistance.service.ISmtpEmailService;
+
+@Service
+public class SmtpEmailServiceImpl implements ISmtpEmailService {
+
+ // SMTP服务器配置信息
+ private static final String SMTP_HOST = "mail.boe.com.cn";
+ private static final String SMTP_USERNAME = "boeu_learning";
+ private static final String SMTP_PASSWORD = "boeLms20250814Syse";
+ private static final String SMTP_PORT = "465";
+ private static final String SMTP_ENCRYPTION = "ssl";
+
+ @Override
+ public void sendMail(String to, String subject, String htmlMsg, String from) throws Exception {
+ sendMailBySmtp(to, subject, htmlMsg, from);
+ }
+
+ @Override
+ public void sendMailBySmtp(String to, String subject, String htmlMsg, String from) throws Exception {
+ // 检查参数
+ if (StringUtils.isBlank(to)) {
+ throw new Exception("发送邮件失败,未指定收件人");
+ }
+
+ if (StringUtils.isBlank(subject)) {
+ throw new Exception("发送邮件失败,未指定邮件主题");
+ }
+
+ if (StringUtils.isBlank(htmlMsg)) {
+ throw new Exception("发送邮件失败,未指定邮件内容");
+ }
+
+ // 设置SMTP属性
+ Properties props = new Properties();
+ props.put("mail.smtp.host", SMTP_HOST);
+ props.put("mail.smtp.port", SMTP_PORT);
+ props.put("mail.smtp.auth", "true");
+
+ if ("ssl".equalsIgnoreCase(SMTP_ENCRYPTION)) {
+ props.put("mail.smtp.ssl.enable", "true");
+ props.put("mail.smtp.ssl.protocols", "TLSv1.2");
+ } else if ("tls".equalsIgnoreCase(SMTP_ENCRYPTION)) {
+ props.put("mail.smtp.starttls.enable", "true");
+ }
+
+ // 创建会话
+ Session session = Session.getInstance(props, new Authenticator() {
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(SMTP_USERNAME, SMTP_PASSWORD);
+ }
+ });
+
+ try {
+ // 创建邮件消息
+ Message message = new MimeMessage(session);
+
+ // 设置发件人
+ String fromAddress = StringUtils.isNotBlank(from) ? from : SMTP_USERNAME + "@boe.com.cn";
+ message.setFrom(new InternetAddress(fromAddress));
+
+ // 设置收件人
+ message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
+
+ // 设置邮件主题
+ message.setSubject(subject);
+
+ // 设置邮件内容
+ message.setContent(htmlMsg, "text/html;charset=UTF-8");
+
+ // 发送邮件
+ Transport.send(message);
+
+ } catch (MessagingException e) {
+ throw new Exception("发送邮件失败", e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CaseKnowledgeServiceImpl.java b/servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CaseKnowledgeServiceImpl.java
index 06f46580..6b2db692 100644
--- a/servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CaseKnowledgeServiceImpl.java
+++ b/servers/boe-server-all/src/main/java/com/xboe/module/boecase/service/impl/CaseKnowledgeServiceImpl.java
@@ -15,6 +15,7 @@ import com.xboe.enums.CaseDocumentLogOptStatusEnum;
import com.xboe.enums.CaseDocumentLogOptTypeEnum;
import com.xboe.enums.CaseDocumentLogRunStatusEnum;
import com.xboe.module.assistance.service.IEmailService;
+import com.xboe.module.assistance.service.ISmtpEmailService;
import com.xboe.module.boecase.dao.CaseDocumentLogDao;
import com.xboe.module.boecase.dao.CasesDao;
import com.xboe.module.boecase.entity.CaseDocumentLog;
@@ -79,6 +80,9 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
@Autowired
private IEmailService emailService;
+ @Autowired
+ private ISmtpEmailService smtpEmailService;
+
private static final String ACCESS_TOKEN_CACHE_KEY = "case:ai:access_token";
@Override
@@ -1274,7 +1278,8 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
if (recipients != null && !recipients.isEmpty()) {
try {
String to = String.join(",", recipients);
- emailService.sendMail(to, subject, content.toString(), null);
+// emailService.sendMail(to, subject, content.toString(), null);
+ smtpEmailService.sendMail(to, subject, content.toString(), null);
} catch (Exception e) {
log.error("发送接口调用失败告警邮件失败", e);
}
@@ -1296,7 +1301,8 @@ public class CaseKnowledgeServiceImpl implements ICaseKnowledgeService {
if (recipients != null && !recipients.isEmpty()) {
try {
String to = String.join(",", recipients);
- emailService.sendMail(to, subject, content.toString(), null);
+// emailService.sendMail(to, subject, content.toString(), null);
+ smtpEmailService.sendMail(to, subject, content.toString(), null);
} catch (Exception e) {
log.error("发送业务处理失败告警邮件失败", e);
}