From 3f978b505cb66d76fa33edb1dcf0b7550062d32c Mon Sep 17 00:00:00 2001 From: wenyann Date: Fri, 16 Jul 2021 17:47:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E9=82=AE=E4=BB=B6=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=BC=80=E5=90=AFTLS=E6=97=B6=EF=BC=8C=E5=8F=91=E9=80=81?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/notice/service/MailService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/notice/service/MailService.java b/backend/src/main/java/io/metersphere/notice/service/MailService.java index dbc8894db4..de4a2d3f68 100644 --- a/backend/src/main/java/io/metersphere/notice/service/MailService.java +++ b/backend/src/main/java/io/metersphere/notice/service/MailService.java @@ -27,11 +27,12 @@ public class MailService { javaMailSender.setDefaultEncoding("UTF-8"); javaMailSender.setProtocol("smtp"); props.put("mail.smtp.auth", "true"); - + String smtpHost = ""; for (SystemParameter p : paramList) { switch (p.getParamKey()) { case "smtp.host": javaMailSender.setHost(p.getParamValue()); + smtpHost = p.getParamValue(); break; case "smtp.port": javaMailSender.setPort(Integer.parseInt(p.getParamValue())); @@ -52,6 +53,7 @@ public class MailService { String result = BooleanUtils.toString(BooleanUtils.toBoolean(p.getParamValue()), "true", "false"); props.put("mail.smtp.starttls.enable", result); props.put("mail.smtp.starttls.required", result); + props.put("mail.smtp.ssl.trust", smtpHost); break; /* case "smtp.anon": boolean isAnon = BooleanUtils.toBoolean(p.getParamValue());