yupeng
2025-03-13 96a7015065775e5c3bc3d6458b86b28ad7bfb46b
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();