hejinbo пре 2 година
родитељ
комит
c60ad9f3fc

+ 25
- 0
ruoyi-admin/src/main/resources/application.yml Прегледај датотеку

91
   web:
91
   web:
92
     resources:
92
     resources:
93
       static-locations:  file:/home/ruoyi/
93
       static-locations:  file:/home/ruoyi/
94
+  mail:
95
+    # 邮件服务地址
96
+    host: smtp.163.com
97
+    # 默认端口25,可不写
98
+    port: 25
99
+    # 编码格式
100
+    default-encoding: utf-8
101
+    # 发送者用户名
102
+    username: xxx@163.com
103
+    # 授权码,刚才获取的代码
104
+    password: xxx
105
+    # 其它参数
106
+    #    properties:
107
+    #      mail:
108
+    #        smtp:
109
+    #          # 如果是用 SSL 方式,需要配置如下属性
110
+    #          ssl:
111
+    #            enable: true
112
+    #            required: true
113
+    #          # 邮件接收时间的限制,单位毫秒
114
+    #          timeout: 10000
115
+    #          # 连接时间的限制,单位毫秒
116
+    #          connectiontimeout: 10000
117
+    #          # 邮件发送时间的限制,单位毫秒
118
+    #          writetimeout: 10000
94
 
119
 
95
 # token配置
120
 # token配置
96
 token:
121
 token:

+ 7
- 0
ruoyi-common/pom.xml Прегледај датотеку

152
             <version>1.9.1</version>
152
             <version>1.9.1</version>
153
         </dependency>
153
         </dependency>
154
 
154
 
155
+        <!--  发送邮件-->
156
+        <dependency>
157
+            <groupId>org.springframework.boot</groupId>
158
+            <artifactId>spring-boot-starter-mail</artifactId>
159
+            <version>3.1.4</version>
160
+        </dependency>
161
+
155
     </dependencies>
162
     </dependencies>
156
 
163
 
157
 </project>
164
 </project>

+ 13
- 5
ruoyi-common/src/main/java/com/ruoyi/common/utils/SendMailUtils.java Прегледај датотеку

1
-package com.ruoyi.common.utils;
2
-
3
-import com.sun.xml.internal.messaging.saaj.packaging.mime.MessagingException;
4
-import org.springframework.core.io.FileSystemResource;
5
-import org.springframework.mail.javamail.MimeMessageHelper;
1
+//package com.ruoyi.common.utils;
2
+//
3
+//
4
+//import jakarta.mail.internet.MimeMessage;
5
+//import org.springframework.beans.factory.annotation.Autowired;
6
+//import org.springframework.core.io.FileSystemResource;
7
+//import org.springframework.mail.javamail.JavaMailSender;
8
+//import org.springframework.mail.javamail.MimeMessageHelper;
9
+//import org.springframework.stereotype.Component;
6
 //
10
 //
7
 //import java.io.File;
11
 //import java.io.File;
8
 //import java.util.List;
12
 //import java.util.List;
9
 //
13
 //
14
+//@Component
10
 //public class SendMailUtils {
15
 //public class SendMailUtils {
16
+//    private static final String SENDER = "xxx@163.com";
17
+//    @Autowired
18
+//    private JavaMailSender mailSender;
11
 //    /**
19
 //    /**
12
 //     * 发送带附件的邮件
20
 //     * 发送带附件的邮件
13
 //     *
21
 //     *