24282 2 سال پیش
والد
کامیت
10c73e2d1f

+ 2 - 0
src/main/java/com/fjhx/email/service/impl/CoreServiceImpl.java

@@ -293,6 +293,8 @@ public class CoreServiceImpl implements ApplicationRunner {
 
         } catch (AuthenticationFailedException | MailConnectException exception) {
 
+            log.error("连接异常", exception);
+
             // 添加异常次数
             map.merge(id, 1, Integer::sum);
 

+ 25 - 14
src/main/java/com/fjhx/email/utils/EmailUtil.java

@@ -34,6 +34,17 @@ public class EmailUtil {
         ImapStoreId.put("support-email", "fjhx@fjhx.com");
     }
 
+    // @SneakyThrows
+    // public static void main(String[] args) {
+    //     MailboxInfo mailboxInfo = new MailboxInfo();
+    //     mailboxInfo.setReceiveHost("imap.gmail.com");
+    //     mailboxInfo.setReceivePort(993);
+    //     mailboxInfo.setMailUser("y2428241269@gmail.com");
+    //     mailboxInfo.setMailPassword("upoujrquwweqtsuk");
+    //     IMAPStore imapStore = getIMAPStore(mailboxInfo);
+    //     System.out.println();
+    // }
+
     /**
      * 获取imapStore
      * 993
@@ -86,20 +97,20 @@ public class EmailUtil {
         }
     }
 
-
-    public static void main(String[] args) throws Exception {
-        ObsFile attachment = new ObsFile();
-        attachment.setFileUrl("https://os.winfaster.cn/fjhx/saas/GrandStar/2023/03/08/png/3092592f2d614d83854fad5e4c107143.png");
-        attachment.setFileName("board-1.png");
-        SendDto.Address address = new SendDto.Address();
-        address.setAddress("2428241269@qq.com");
-        SendDto sendDto = new SendDto();
-        sendDto.setTo(Collections.singletonList(address));
-        sendDto.setFileList(Collections.singletonList(attachment));
-        sendDto.setSubject("测试标题");
-        sendDto.setContent("测试内容");
-        sendMail("imap.qq.com", "2428241269@qq.com", "kdypajdrwfhtdihb", sendDto);
-    }
+    //
+    // public static void main(String[] args) throws Exception {
+    //     ObsFile attachment = new ObsFile();
+    //     attachment.setFileUrl("https://os.winfaster.cn/fjhx/saas/GrandStar/2023/03/08/png/3092592f2d614d83854fad5e4c107143.png");
+    //     attachment.setFileName("board-1.png");
+    //     SendDto.Address address = new SendDto.Address();
+    //     address.setAddress("2428241269@qq.com");
+    //     SendDto sendDto = new SendDto();
+    //     sendDto.setTo(Collections.singletonList(address));
+    //     sendDto.setFileList(Collections.singletonList(attachment));
+    //     sendDto.setSubject("测试标题");
+    //     sendDto.setContent("测试内容");
+    //     sendMail("imap.qq.com", "2428241269@qq.com", "kdypajdrwfhtdihb", sendDto);
+    // }
 
 
     /**

+ 1 - 1
src/main/resources/application-dev.yml

@@ -15,6 +15,6 @@ mail:
   # 超过多少次后将不再同步此邮箱
   errorNumber: 5
   # 获取邮箱类型 1国内邮箱 2国外邮箱
-  mailType: 1
+  mailType: 2
   # 调用主服务url前缀
   urlPrefix: http://localhost:9898/open/mail/