From 7227b70fa89e7f65a6978cd84e906cba44f01bda Mon Sep 17 00:00:00 2001 From: xiaoguangbin Date: Tue, 29 Oct 2024 16:08:35 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"fix=EF=BC=9A=E4=BF=AE=E6=94=B9gamma?= =?UTF-8?q?=E6=8A=A5=E5=91=8A=20#MINIMUM=20=E9=83=A8=E5=88=86=EF=BC=8Cmdc?= =?UTF-8?q?=E6=A0=87=E9=A2=98=E5=A2=9E=E5=8A=A0=E5=8D=95=E4=BD=8D=EF=BC=8C?= =?UTF-8?q?mda=E6=B2=A1=E6=95=B0=E6=8D=AE=E5=88=99=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit cca97c9ca8011018f3c531a1d9de5fde1e367574. --- .../org/jeecg/common/util/MyMailUtil.java | 83 ------------------- 1 file changed, 83 deletions(-) delete mode 100644 jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MyMailUtil.java diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MyMailUtil.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MyMailUtil.java deleted file mode 100644 index 23d6a023..00000000 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/MyMailUtil.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.jeecg.common.util; - -import cn.hutool.core.util.StrUtil; - -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; -import java.util.Date; -import java.util.Objects; - -public class MyMailUtil { - - private Integer port; - - public MyMailUtil(Integer port){ - this.port = port; - } - - /** - * 获取邮件主题 - * @param message - * @return - */ - public static String getSubject(Message message) throws MessagingException{ - String subject = null; - try { - subject = message.getSubject(); - } catch (MessagingException e) { - try { - subject = message.getHeader("subject")[0]; - } catch (MessagingException ex) { - throw new RuntimeException(ex); - } - } - return subject; - } - - public static Date getReceivedDate(Message message) throws MessagingException{ - Date receivedDate = null; - try { - receivedDate = message.getReceivedDate(); - } catch (MessagingException e) { - try { - receivedDate = new Date(message.getHeader("Date")[0]); - } catch (MessagingException ex) { - throw new RuntimeException(ex); - } - } - return receivedDate; - } - - public static String getMessageID(Message message) throws MessagingException{ - String messageId = ""; - try { - messageId = ((MimeMessage) message).getMessageID(); - } catch (MessagingException e) { - try { - messageId = Objects.isNull(message.getHeader("Message-ID")) ? "" : message.getHeader("Message-ID")[0]; - } catch (MessagingException ex) { - throw new RuntimeException(ex); - } - } - return messageId; - } - - public static String getAddress(Message message) throws MessagingException{ - String address = ""; - try { - address = ((InternetAddress) message.getFrom()[0]).getAddress(); - } catch (MessagingException e) { - try { - String[] froms = message.getHeader("From"); - if (null != froms) { - address = StrUtil.subBetween(froms[0], "<",">"); - } - } catch (MessagingException ex) { - throw new RuntimeException(ex); - } - } - return address; - } -}