From fde65a21f41ae7ba1debe6eb976b9470f3929202 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期三, 12 三月 2025 15:14:09 +0800 Subject: [PATCH] bug修改 --- ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java index e418db1..4ce4421 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/TencentMailUtil.java @@ -52,7 +52,8 @@ // 访问SMTP服务时需要提供的密码(在控制台选择发信地址进行设置) props.put("mail.password", properties.getPassword()); props.setProperty("mail.smtp.socketFactory.fallback", "false"); - props.put("mail.smtp.ssl.enable", "false"); + props.put("mail.smtp.ssl.enable", "true"); + props.put("mail.smtp.ssl.protocols", "TLSv1.2"); // 构建授权信息,用于进行SMTP进行身份验证 Authenticator authenticator = new Authenticator() { @Override @@ -96,8 +97,12 @@ //发送邮件 Transport.send(message); } catch (MessagingException | UnsupportedEncodingException e) { + e.printStackTrace(); log.error("发送邮件发生异常",e); throw new ServiceException("发送邮件失败,请检查"); + }catch (Exception e){ + e.printStackTrace(); + log.error("发送邮件发生异常",e); } } @@ -170,6 +175,9 @@ }; } + + + private Multipart createMultipart(List<Map<String, String>> list) throws MessagingException, UnsupportedEncodingException, MalformedURLException { Multipart multipart = new MimeMultipart(); -- Gitblit v1.7.1