diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 06fa6f1..17c2d28 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -91,6 +91,31 @@ spring: web: resources: static-locations: file:/home/ruoyi/ + mail: + # 邮件服务地址 + host: smtp.163.com + # 默认端口25,可不写 + port: 25 + # 编码格式 + default-encoding: utf-8 + # 发送者用户名 + username: xxx@163.com + # 授权码,刚才获取的代码 + password: xxx + # 其它参数 + # properties: + # mail: + # smtp: + # # 如果是用 SSL 方式,需要配置如下属性 + # ssl: + # enable: true + # required: true + # # 邮件接收时间的限制,单位毫秒 + # timeout: 10000 + # # 连接时间的限制,单位毫秒 + # connectiontimeout: 10000 + # # 邮件发送时间的限制,单位毫秒 + # writetimeout: 10000 # token配置 token: diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 5307193..7f49eaa 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -152,6 +152,13 @@ 1.9.1 + + + org.springframework.boot + spring-boot-starter-mail + 3.1.4 + + \ No newline at end of file diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SendMailUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SendMailUtils.java index 216e77a..71cba3e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/SendMailUtils.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/SendMailUtils.java @@ -1,13 +1,21 @@ -package com.ruoyi.common.utils; - -import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException; -import org.springframework.core.io.FileSystemResource; -import org.springframework.mail.javamail.MimeMessageHelper; +//package com.ruoyi.common.utils; +// +// +//import jakarta.mail.internet.MimeMessage; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.core.io.FileSystemResource; +//import org.springframework.mail.javamail.JavaMailSender; +//import org.springframework.mail.javamail.MimeMessageHelper; +//import org.springframework.stereotype.Component; // //import java.io.File; //import java.util.List; // +//@Component //public class SendMailUtils { +// private static final String SENDER = "xxx@163.com"; +// @Autowired +// private JavaMailSender mailSender; // /** // * 发送带附件的邮件 // *