From ca06a2311da20502ad54f4593f1f18a177c07c76 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期二, 13 八月 2024 13:32:34 +0800
Subject: [PATCH] update hutool 5.8.29 => 5.8.31 解决hutool不兼容jakarta问题

---
 /dev/null                                                                                   |   33 ---------------------------------
 ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailUtils.java   |   12 +++++++-----
 pom.xml                                                                                     |    2 +-
 ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/config/MailConfig.java |    2 +-
 4 files changed, 9 insertions(+), 40 deletions(-)

diff --git a/pom.xml b/pom.xml
index bbb394e..7772834 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@
         <satoken.version>1.38.0</satoken.version>
         <mybatis-plus.version>3.5.7</mybatis-plus.version>
         <p6spy.version>3.9.1</p6spy.version>
-        <hutool.version>5.8.29</hutool.version>
+        <hutool.version>5.8.31</hutool.version>
         <okhttp.version>4.10.0</okhttp.version>
         <spring-boot-admin.version>3.2.3</spring-boot-admin.version>
         <redisson.version>3.34.1</redisson.version>
diff --git a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/config/MailConfig.java b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/config/MailConfig.java
index 1b51c27..0ea3007 100644
--- a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/config/MailConfig.java
+++ b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/config/MailConfig.java
@@ -1,7 +1,7 @@
 package org.dromara.common.mail.config;
 
+import cn.hutool.extra.mail.MailAccount;
 import org.dromara.common.mail.config.properties.MailProperties;
-import org.dromara.common.mail.utils.MailAccount;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
diff --git a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/GlobalMailAccount.java b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/GlobalMailAccount.java
deleted file mode 100644
index fdae869..0000000
--- a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/GlobalMailAccount.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.dromara.common.mail.utils;
-
-import cn.hutool.core.io.IORuntimeException;
-
-/**
- * 鍏ㄥ眬閭欢甯愭埛锛屼緷璧栦簬閭欢閰嶇疆鏂囦欢{@link MailAccount#MAIL_SETTING_PATHS}
- *
- * @author looly
- */
-public enum GlobalMailAccount {
-    INSTANCE;
-
-    private final MailAccount mailAccount;
-
-    /**
-     * 鏋勯��
-     */
-    GlobalMailAccount() {
-        mailAccount = createDefaultAccount();
-    }
-
-    /**
-     * 鑾峰緱閭欢甯愭埛
-     *
-     * @return 閭欢甯愭埛
-     */
-    public MailAccount getAccount() {
-        return this.mailAccount;
-    }
-
-    /**
-     * 鍒涘缓榛樿甯愭埛
-     *
-     * @return MailAccount
-     */
-    private MailAccount createDefaultAccount() {
-        for (String mailSettingPath : MailAccount.MAIL_SETTING_PATHS) {
-            try {
-                return new MailAccount(mailSettingPath);
-            } catch (IORuntimeException ignore) {
-                //ignore
-            }
-        }
-        return null;
-    }
-}
diff --git a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/InternalMailUtil.java b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/InternalMailUtil.java
deleted file mode 100644
index b755e73..0000000
--- a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/InternalMailUtil.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.dromara.common.mail.utils;
-
-import cn.hutool.core.util.ArrayUtil;
-import jakarta.mail.internet.AddressException;
-import jakarta.mail.internet.InternetAddress;
-import jakarta.mail.internet.MimeUtility;
-
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * 閭欢鍐呴儴宸ュ叿绫�
- *
- * @author looly
- * @since 3.2.3
- */
-public class InternalMailUtil {
-
-    /**
-     * 灏嗗涓瓧绗︿覆閭欢鍦板潃杞负{@link InternetAddress}鍒楄〃<br>
-     * 鍗曚釜瀛楃涓插湴鍧�鍙互鏄涓湴鍧�鍚堝苟鐨勫瓧绗︿覆
-     *
-     * @param addrStrs 鍦板潃鏁扮粍
-     * @param charset  缂栫爜锛堜富瑕佺敤浜庝腑鏂囩敤鎴峰悕鐨勭紪鐮侊級
-     * @return 鍦板潃鏁扮粍
-     * @since 4.0.3
-     */
-    public static InternetAddress[] parseAddressFromStrs(String[] addrStrs, Charset charset) {
-        final List<InternetAddress> resultList = new ArrayList<>(addrStrs.length);
-        InternetAddress[] addrs;
-        for (String addrStr : addrStrs) {
-            addrs = parseAddress(addrStr, charset);
-            if (ArrayUtil.isNotEmpty(addrs)) {
-                Collections.addAll(resultList, addrs);
-            }
-        }
-        return resultList.toArray(new InternetAddress[0]);
-    }
-
-    /**
-     * 瑙f瀽绗竴涓湴鍧�
-     *
-     * @param address 鍦板潃瀛楃涓�
-     * @param charset 缂栫爜锛寋@code null}琛ㄧず浣跨敤绯荤粺灞炴�у畾涔夌殑缂栫爜鎴栫郴缁熺紪鐮�
-     * @return 鍦板潃鍒楄〃
-     */
-    public static InternetAddress parseFirstAddress(String address, Charset charset) {
-        final InternetAddress[] internetAddresses = parseAddress(address, charset);
-        if (ArrayUtil.isEmpty(internetAddresses)) {
-            try {
-                return new InternetAddress(address);
-            } catch (AddressException e) {
-                throw new MailException(e);
-            }
-        }
-        return internetAddresses[0];
-    }
-
-    /**
-     * 灏嗕竴涓湴鍧�瀛楃涓茶В鏋愪负澶氫釜鍦板潃<br>
-     * 鍦板潃闂翠娇鐢�" "銆�","銆�";"鍒嗛殧
-     *
-     * @param address 鍦板潃瀛楃涓�
-     * @param charset 缂栫爜锛寋@code null}琛ㄧず浣跨敤绯荤粺灞炴�у畾涔夌殑缂栫爜鎴栫郴缁熺紪鐮�
-     * @return 鍦板潃鍒楄〃
-     */
-    public static InternetAddress[] parseAddress(String address, Charset charset) {
-        InternetAddress[] addresses;
-        try {
-            addresses = InternetAddress.parse(address);
-        } catch (AddressException e) {
-            throw new MailException(e);
-        }
-        //缂栫爜鐢ㄦ埛鍚�
-        if (ArrayUtil.isNotEmpty(addresses)) {
-            final String charsetStr = null == charset ? null : charset.name();
-            for (InternetAddress internetAddress : addresses) {
-                try {
-                    internetAddress.setPersonal(internetAddress.getPersonal(), charsetStr);
-                } catch (UnsupportedEncodingException e) {
-                    throw new MailException(e);
-                }
-            }
-        }
-
-        return addresses;
-    }
-
-    /**
-     * 缂栫爜涓枃瀛楃<br>
-     * 缂栫爜澶辫触杩斿洖鍘熷瓧绗︿覆
-     *
-     * @param text    琚紪鐮佺殑鏂囨湰
-     * @param charset 缂栫爜
-     * @return 缂栫爜鍚庣殑缁撴灉
-     */
-    public static String encodeText(String text, Charset charset) {
-        try {
-            return MimeUtility.encodeText(text, charset.name(), null);
-        } catch (UnsupportedEncodingException e) {
-            // ignore
-        }
-        return text;
-    }
-}
diff --git a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/Mail.java b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/Mail.java
deleted file mode 100644
index 6ca4b69..0000000
--- a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/Mail.java
+++ /dev/null
@@ -1,483 +0,0 @@
-package org.dromara.common.mail.utils;
-
-import cn.hutool.core.builder.Builder;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.io.IORuntimeException;
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.util.ArrayUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import jakarta.activation.DataHandler;
-import jakarta.activation.DataSource;
-import jakarta.activation.FileDataSource;
-import jakarta.activation.FileTypeMap;
-import jakarta.mail.*;
-import jakarta.mail.internet.MimeBodyPart;
-import jakarta.mail.internet.MimeMessage;
-import jakarta.mail.internet.MimeMultipart;
-import jakarta.mail.internet.MimeUtility;
-import jakarta.mail.util.ByteArrayDataSource;
-
-import java.io.*;
-import java.nio.charset.Charset;
-import java.util.Date;
-
-/**
- * 閭欢鍙戦�佸鎴风
- *
- * @author looly
- * @since 3.2.0
- */
-public class Mail implements Builder<MimeMessage> {
-    @Serial
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 閭甯愭埛淇℃伅浠ュ強涓�浜涘鎴风閰嶇疆淇℃伅
-     */
-    private final MailAccount mailAccount;
-    /**
-     * 鏀朵欢浜哄垪琛�
-     */
-    private String[] tos;
-    /**
-     * 鎶勯�佷汉鍒楄〃锛坈arbon copy锛�
-     */
-    private String[] ccs;
-    /**
-     * 瀵嗛�佷汉鍒楄〃锛坆lind carbon copy锛�
-     */
-    private String[] bccs;
-    /**
-     * 鍥炲鍦板潃(reply-to)
-     */
-    private String[] reply;
-    /**
-     * 鏍囬
-     */
-    private String title;
-    /**
-     * 鍐呭
-     */
-    private String content;
-    /**
-     * 鏄惁涓篐TML
-     */
-    private boolean isHtml;
-    /**
-     * 姝f枃銆侀檮浠跺拰鍥剧墖鐨勬贩鍚堥儴鍒�
-     */
-    private final Multipart multipart = new MimeMultipart();
-    /**
-     * 鏄惁浣跨敤鍏ㄥ眬浼氳瘽锛岄粯璁や负false
-     */
-    private boolean useGlobalSession = false;
-
-    /**
-     * debug杈撳嚭浣嶇疆锛屽彲浠ヨ嚜瀹氫箟debug鏃ュ織
-     */
-    private PrintStream debugOutput;
-
-    /**
-     * 鍒涘缓閭欢瀹㈡埛绔�
-     *
-     * @param mailAccount 閭欢甯愬彿
-     * @return Mail
-     */
-    public static Mail create(MailAccount mailAccount) {
-        return new Mail(mailAccount);
-    }
-
-    /**
-     * 鍒涘缓閭欢瀹㈡埛绔紝浣跨敤鍏ㄥ眬閭欢甯愭埛
-     *
-     * @return Mail
-     */
-    public static Mail create() {
-        return new Mail();
-    }
-
-    // --------------------------------------------------------------- Constructor start
-
-    /**
-     * 鏋勯�狅紝浣跨敤鍏ㄥ眬閭欢甯愭埛
-     */
-    public Mail() {
-        this(GlobalMailAccount.INSTANCE.getAccount());
-    }
-
-    /**
-     * 鏋勯��
-     *
-     * @param mailAccount 閭欢甯愭埛锛屽鏋滀负null浣跨敤榛樿閰嶇疆鏂囦欢鐨勫叏灞�閭欢閰嶇疆
-     */
-    public Mail(MailAccount mailAccount) {
-        mailAccount = (null != mailAccount) ? mailAccount : GlobalMailAccount.INSTANCE.getAccount();
-        this.mailAccount = mailAccount.defaultIfEmpty();
-    }
-    // --------------------------------------------------------------- Constructor end
-
-    // --------------------------------------------------------------- Getters and Setters start
-
-    /**
-     * 璁剧疆鏀朵欢浜�
-     *
-     * @param tos 鏀朵欢浜哄垪琛�
-     * @return this
-     * @see #setTos(String...)
-     */
-    public Mail to(String... tos) {
-        return setTos(tos);
-    }
-
-    /**
-     * 璁剧疆澶氫釜鏀朵欢浜�
-     *
-     * @param tos 鏀朵欢浜哄垪琛�
-     * @return this
-     */
-    public Mail setTos(String... tos) {
-        this.tos = tos;
-        return this;
-    }
-
-    /**
-     * 璁剧疆澶氫釜鎶勯�佷汉锛坈arbon copy锛�
-     *
-     * @param ccs 鎶勯�佷汉鍒楄〃
-     * @return this
-     * @since 4.0.3
-     */
-    public Mail setCcs(String... ccs) {
-        this.ccs = ccs;
-        return this;
-    }
-
-    /**
-     * 璁剧疆澶氫釜瀵嗛�佷汉锛坆lind carbon copy锛�
-     *
-     * @param bccs 瀵嗛�佷汉鍒楄〃
-     * @return this
-     * @since 4.0.3
-     */
-    public Mail setBccs(String... bccs) {
-        this.bccs = bccs;
-        return this;
-    }
-
-    /**
-     * 璁剧疆澶氫釜鍥炲鍦板潃(reply-to)
-     *
-     * @param reply 鍥炲鍦板潃(reply-to)鍒楄〃
-     * @return this
-     * @since 4.6.0
-     */
-    public Mail setReply(String... reply) {
-        this.reply = reply;
-        return this;
-    }
-
-    /**
-     * 璁剧疆鏍囬
-     *
-     * @param title 鏍囬
-     * @return this
-     */
-    public Mail setTitle(String title) {
-        this.title = title;
-        return this;
-    }
-
-    /**
-     * 璁剧疆姝f枃<br>
-     * 姝f枃鍙互鏄櫘閫氭枃鏈篃鍙互鏄疕TML锛堥粯璁ゆ櫘閫氭枃鏈級锛屽彲浠ラ�氳繃璋冪敤{@link #setHtml(boolean)} 璁剧疆鏄惁涓篐TML
-     *
-     * @param content 姝f枃
-     * @return this
-     */
-    public Mail setContent(String content) {
-        this.content = content;
-        return this;
-    }
-
-    /**
-     * 璁剧疆鏄惁鏄疕TML
-     *
-     * @param isHtml 鏄惁涓篐TML
-     * @return this
-     */
-    public Mail setHtml(boolean isHtml) {
-        this.isHtml = isHtml;
-        return this;
-    }
-
-    /**
-     * 璁剧疆姝f枃
-     *
-     * @param content 姝f枃鍐呭
-     * @param isHtml  鏄惁涓篐TML
-     * @return this
-     */
-    public Mail setContent(String content, boolean isHtml) {
-        setContent(content);
-        return setHtml(isHtml);
-    }
-
-    /**
-     * 璁剧疆鏂囦欢绫诲瀷闄勪欢锛屾枃浠跺彲浠ユ槸鍥剧墖鏂囦欢锛屾鏃惰嚜鍔ㄨ缃甤id锛堟鏂囦腑寮曠敤鍥剧墖锛夛紝榛樿cid涓烘枃浠跺悕
-     *
-     * @param files 闄勪欢鏂囦欢鍒楄〃
-     * @return this
-     */
-    public Mail setFiles(File... files) {
-        if (ArrayUtil.isEmpty(files)) {
-            return this;
-        }
-
-        final DataSource[] attachments = new DataSource[files.length];
-        for (int i = 0; i < files.length; i++) {
-            attachments[i] = new FileDataSource(files[i]);
-        }
-        return setAttachments(attachments);
-    }
-
-    /**
-     * 澧炲姞闄勪欢鎴栧浘鐗囷紝闄勪欢浣跨敤{@link DataSource} 褰㈠紡琛ㄧず锛屽彲浠ヤ娇鐢▄@link FileDataSource}鍖呰鏂囦欢琛ㄧず鏂囦欢闄勪欢
-     *
-     * @param attachments 闄勪欢鍒楄〃
-     * @return this
-     * @since 4.0.9
-     */
-    public Mail setAttachments(DataSource... attachments) {
-        if (ArrayUtil.isNotEmpty(attachments)) {
-            final Charset charset = this.mailAccount.getCharset();
-            MimeBodyPart bodyPart;
-            String nameEncoded;
-            try {
-                for (DataSource attachment : attachments) {
-                    bodyPart = new MimeBodyPart();
-                    bodyPart.setDataHandler(new DataHandler(attachment));
-                    nameEncoded = attachment.getName();
-                    if (this.mailAccount.isEncodefilename()) {
-                        nameEncoded = InternalMailUtil.encodeText(nameEncoded, charset);
-                    }
-                    // 鏅�氶檮浠舵枃浠跺悕
-                    bodyPart.setFileName(nameEncoded);
-                    if (StrUtil.startWith(attachment.getContentType(), "image/")) {
-                        // 鍥剧墖闄勪欢锛岀敤浜庢鏂囦腑寮曠敤鍥剧墖
-                        bodyPart.setContentID(nameEncoded);
-                    }
-                    this.multipart.addBodyPart(bodyPart);
-                }
-            } catch (MessagingException e) {
-                throw new MailException(e);
-            }
-        }
-        return this;
-    }
-
-    /**
-     * 澧炲姞鍥剧墖锛屽浘鐗囩殑閿搴斿埌閭欢妯℃澘涓殑鍗犱綅瀛楃涓诧紝鍥剧墖绫诲瀷榛樿涓�"image/jpeg"
-     *
-     * @param cid         鍥剧墖涓庡崰浣嶇锛屽崰浣嶇鏍煎紡涓篶id:${cid}
-     * @param imageStream 鍥剧墖鏂囦欢
-     * @return this
-     * @since 4.6.3
-     */
-    public Mail addImage(String cid, InputStream imageStream) {
-        return addImage(cid, imageStream, null);
-    }
-
-    /**
-     * 澧炲姞鍥剧墖锛屽浘鐗囩殑閿搴斿埌閭欢妯℃澘涓殑鍗犱綅瀛楃涓�
-     *
-     * @param cid         鍥剧墖涓庡崰浣嶇锛屽崰浣嶇鏍煎紡涓篶id:${cid}
-     * @param imageStream 鍥剧墖娴侊紝涓嶅叧闂�
-     * @param contentType 鍥剧墖绫诲瀷锛宯ull璧嬪�奸粯璁ょ殑"image/jpeg"
-     * @return this
-     * @since 4.6.3
-     */
-    public Mail addImage(String cid, InputStream imageStream, String contentType) {
-        ByteArrayDataSource imgSource;
-        try {
-            imgSource = new ByteArrayDataSource(imageStream, ObjectUtil.defaultIfNull(contentType, "image/jpeg"));
-        } catch (IOException e) {
-            throw new IORuntimeException(e);
-        }
-        imgSource.setName(cid);
-        return setAttachments(imgSource);
-    }
-
-    /**
-     * 澧炲姞鍥剧墖锛屽浘鐗囩殑閿搴斿埌閭欢妯℃澘涓殑鍗犱綅瀛楃涓�
-     *
-     * @param cid       鍥剧墖涓庡崰浣嶇锛屽崰浣嶇鏍煎紡涓篶id:${cid}
-     * @param imageFile 鍥剧墖鏂囦欢
-     * @return this
-     * @since 4.6.3
-     */
-    public Mail addImage(String cid, File imageFile) {
-        InputStream in = null;
-        try {
-            in = FileUtil.getInputStream(imageFile);
-            return addImage(cid, in, FileTypeMap.getDefaultFileTypeMap().getContentType(imageFile));
-        } finally {
-            IoUtil.close(in);
-        }
-    }
-
-    /**
-     * 璁剧疆瀛楃闆嗙紪鐮�
-     *
-     * @param charset 瀛楃闆嗙紪鐮�
-     * @return this
-     * @see MailAccount#setCharset(Charset)
-     */
-    public Mail setCharset(Charset charset) {
-        this.mailAccount.setCharset(charset);
-        return this;
-    }
-
-    /**
-     * 璁剧疆鏄惁浣跨敤鍏ㄥ眬浼氳瘽锛岄粯璁や负true
-     *
-     * @param isUseGlobalSession 鏄惁浣跨敤鍏ㄥ眬浼氳瘽锛岄粯璁や负true
-     * @return this
-     * @since 4.0.2
-     */
-    public Mail setUseGlobalSession(boolean isUseGlobalSession) {
-        this.useGlobalSession = isUseGlobalSession;
-        return this;
-    }
-
-    /**
-     * 璁剧疆debug杈撳嚭浣嶇疆锛屽彲浠ヨ嚜瀹氫箟debug鏃ュ織
-     *
-     * @param debugOutput debug杈撳嚭浣嶇疆
-     * @return this
-     * @since 5.5.6
-     */
-    public Mail setDebugOutput(PrintStream debugOutput) {
-        this.debugOutput = debugOutput;
-        return this;
-    }
-    // --------------------------------------------------------------- Getters and Setters end
-
-    @Override
-    public MimeMessage build() {
-        try {
-            return buildMsg();
-        } catch (MessagingException e) {
-            throw new MailException(e);
-        }
-    }
-
-    /**
-     * 鍙戦��
-     *
-     * @return message-id
-     * @throws MailException 閭欢鍙戦�佸紓甯�
-     */
-    public String send() throws MailException {
-        try {
-            return doSend();
-        } catch (MessagingException e) {
-            if (e instanceof SendFailedException) {
-                // 褰撳湴鍧�鏃犳晥鏃讹紝鏄剧ず鏇村姞璇︾粏鐨勬棤鏁堝湴鍧�淇℃伅
-                final Address[] invalidAddresses = ((SendFailedException) e).getInvalidAddresses();
-                final String msg = StrUtil.format("Invalid Addresses: {}", ArrayUtil.toString(invalidAddresses));
-                throw new MailException(msg, e);
-            }
-            throw new MailException(e);
-        }
-    }
-
-    // --------------------------------------------------------------- Private method start
-
-    /**
-     * 鎵ц鍙戦��
-     *
-     * @return message-id
-     * @throws MessagingException 鍙戦�佸紓甯�
-     */
-    private String doSend() throws MessagingException {
-        final MimeMessage mimeMessage = buildMsg();
-        Transport.send(mimeMessage);
-        return mimeMessage.getMessageID();
-    }
-
-    /**
-     * 鏋勫缓娑堟伅
-     *
-     * @return {@link MimeMessage}娑堟伅
-     * @throws MessagingException 娑堟伅寮傚父
-     */
-    private MimeMessage buildMsg() throws MessagingException {
-        final Charset charset = this.mailAccount.getCharset();
-        final MimeMessage msg = new MimeMessage(getSession());
-        // 鍙戜欢浜�
-        final String from = this.mailAccount.getFrom();
-        if (StrUtil.isEmpty(from)) {
-            // 鐢ㄦ埛鏈彁渚涘彂閫佹柟锛屽垯浠嶴ession涓嚜鍔ㄨ幏鍙�
-            msg.setFrom();
-        } else {
-            msg.setFrom(InternalMailUtil.parseFirstAddress(from, charset));
-        }
-        // 鏍囬
-        msg.setSubject(this.title, (null == charset) ? null : charset.name());
-        // 鍙戦�佹椂闂�
-        msg.setSentDate(new Date());
-        // 鍐呭鍜岄檮浠�
-        msg.setContent(buildContent(charset));
-        // 鏀朵欢浜�
-        msg.setRecipients(MimeMessage.RecipientType.TO, InternalMailUtil.parseAddressFromStrs(this.tos, charset));
-        // 鎶勯�佷汉
-        if (ArrayUtil.isNotEmpty(this.ccs)) {
-            msg.setRecipients(MimeMessage.RecipientType.CC, InternalMailUtil.parseAddressFromStrs(this.ccs, charset));
-        }
-        // 瀵嗛�佷汉
-        if (ArrayUtil.isNotEmpty(this.bccs)) {
-            msg.setRecipients(MimeMessage.RecipientType.BCC, InternalMailUtil.parseAddressFromStrs(this.bccs, charset));
-        }
-        // 鍥炲鍦板潃(reply-to)
-        if (ArrayUtil.isNotEmpty(this.reply)) {
-            msg.setReplyTo(InternalMailUtil.parseAddressFromStrs(this.reply, charset));
-        }
-
-        return msg;
-    }
-
-    /**
-     * 鏋勫缓閭欢淇℃伅涓讳綋
-     *
-     * @param charset 缂栫爜锛寋@code null}鍒欎娇鐢▄@link MimeUtility#getDefaultJavaCharset()}
-     * @return 閭欢淇℃伅涓讳綋
-     * @throws MessagingException 娑堟伅寮傚父
-     */
-    private Multipart buildContent(Charset charset) throws MessagingException {
-        final String charsetStr = null != charset ? charset.name() : MimeUtility.getDefaultJavaCharset();
-        // 姝f枃
-        final MimeBodyPart body = new MimeBodyPart();
-        body.setContent(content, StrUtil.format("text/{}; charset={}", isHtml ? "html" : "plain", charsetStr));
-        this.multipart.addBodyPart(body);
-
-        return this.multipart;
-    }
-
-    /**
-     * 鑾峰彇榛樿閭欢浼氳瘽<br>
-     * 濡傛灉涓哄叏灞�鍗曚緥鐨勪細璇濓紝鍒欏叏灞�鍙厑璁镐竴涓偖浠跺笎鍙凤紝鍚﹀垯姣忔鍙戦�侀偖浠朵細鏂板缓涓�涓柊鐨勪細璇�
-     *
-     * @return 閭欢浼氳瘽 {@link Session}
-     */
-    private Session getSession() {
-        final Session session = MailUtils.getSession(this.mailAccount, this.useGlobalSession);
-
-        if (null != this.debugOutput) {
-            session.setDebugOut(debugOutput);
-        }
-
-        return session;
-    }
-    // --------------------------------------------------------------- Private method end
-}
diff --git a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailAccount.java b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailAccount.java
deleted file mode 100644
index 2a732a1..0000000
--- a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailAccount.java
+++ /dev/null
@@ -1,659 +0,0 @@
-package org.dromara.common.mail.utils;
-
-import cn.hutool.core.util.CharsetUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.setting.Setting;
-
-import java.io.Serial;
-import java.io.Serializable;
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * 閭欢璐︽埛瀵硅薄
- *
- * @author Luxiaolei
- */
-public class MailAccount implements Serializable {
-    @Serial
-    private static final long serialVersionUID = -6937313421815719204L;
-
-    private static final String MAIL_PROTOCOL = "mail.transport.protocol";
-    private static final String SMTP_HOST = "mail.smtp.host";
-    private static final String SMTP_PORT = "mail.smtp.port";
-    private static final String SMTP_AUTH = "mail.smtp.auth";
-    private static final String SMTP_TIMEOUT = "mail.smtp.timeout";
-    private static final String SMTP_CONNECTION_TIMEOUT = "mail.smtp.connectiontimeout";
-    private static final String SMTP_WRITE_TIMEOUT = "mail.smtp.writetimeout";
-
-    // SSL
-    private static final String STARTTLS_ENABLE = "mail.smtp.starttls.enable";
-    private static final String SSL_ENABLE = "mail.smtp.ssl.enable";
-    private static final String SSL_PROTOCOLS = "mail.smtp.ssl.protocols";
-    private static final String SOCKET_FACTORY = "mail.smtp.socketFactory.class";
-    private static final String SOCKET_FACTORY_FALLBACK = "mail.smtp.socketFactory.fallback";
-    private static final String SOCKET_FACTORY_PORT = "smtp.socketFactory.port";
-
-    // System Properties
-    private static final String SPLIT_LONG_PARAMS = "mail.mime.splitlongparameters";
-    //private static final String ENCODE_FILE_NAME = "mail.mime.encodefilename";
-    //private static final String CHARSET = "mail.mime.charset";
-
-    // 鍏朵粬
-    private static final String MAIL_DEBUG = "mail.debug";
-
-    public static final String[] MAIL_SETTING_PATHS = new String[]{"config/mail.setting", "config/mailAccount.setting", "mail.setting"};
-
-    /**
-     * SMTP鏈嶅姟鍣ㄥ煙鍚�
-     */
-    private String host;
-    /**
-     * SMTP鏈嶅姟绔彛
-     */
-    private Integer port;
-    /**
-     * 鏄惁闇�瑕佺敤鎴峰悕瀵嗙爜楠岃瘉
-     */
-    private Boolean auth;
-    /**
-     * 鐢ㄦ埛鍚�
-     */
-    private String user;
-    /**
-     * 瀵嗙爜
-     */
-    private String pass;
-    /**
-     * 鍙戦�佹柟锛岄伒寰猂FC-822鏍囧噯
-     */
-    private String from;
-
-    /**
-     * 鏄惁鎵撳紑璋冭瘯妯″紡锛岃皟璇曟ā寮忎細鏄剧ず涓庨偖浠舵湇鍔″櫒閫氫俊杩囩▼锛岄粯璁や笉寮�鍚�
-     */
-    private boolean debug;
-    /**
-     * 缂栫爜鐢ㄤ簬缂栫爜閭欢姝f枃鍜屽彂閫佷汉銆佹敹浠朵汉绛変腑鏂�
-     */
-    private Charset charset = CharsetUtil.CHARSET_UTF_8;
-    /**
-     * 瀵逛簬瓒呴暱鍙傛暟鏄惁鍒囧垎涓哄浠斤紝榛樿涓篺alse锛堝浗鍐呴偖绠遍檮浠朵笉鏀寔鍒囧垎鐨勯檮浠跺悕锛�
-     */
-    private boolean splitlongparameters = false;
-    /**
-     * 瀵逛簬鏂囦欢鍚嶆槸鍚︿娇鐢▄@link #charset}缂栫爜锛岄粯璁や负 {@code true}
-     */
-    private boolean encodefilename = true;
-
-    /**
-     * 浣跨敤 STARTTLS瀹夊叏杩炴帴锛孲TARTTLS鏄绾枃鏈�氫俊鍗忚鐨勬墿灞曘�傚畠灏嗙函鏂囨湰杩炴帴鍗囩骇涓哄姞瀵嗚繛鎺ワ紙TLS鎴朣SL锛夛紝 鑰屼笉鏄娇鐢ㄤ竴涓崟鐙殑鍔犲瘑閫氫俊绔彛銆�
-     */
-    private boolean starttlsEnable = false;
-    /**
-     * 浣跨敤 SSL瀹夊叏杩炴帴
-     */
-    private Boolean sslEnable;
-
-    /**
-     * SSL鍗忚锛屽涓崗璁敤绌烘牸鍒嗛殧
-     */
-    private String sslProtocols;
-
-    /**
-     * 鎸囧畾瀹炵幇javax.net.SocketFactory鎺ュ彛鐨勭被鐨勫悕绉�,杩欎釜绫诲皢琚敤浜庡垱寤篠MTP鐨勫鎺ュ瓧
-     */
-    private String socketFactoryClass = "javax.net.ssl.SSLSocketFactory";
-    /**
-     * 濡傛灉璁剧疆涓簍rue,鏈兘鍒涘缓涓�涓鎺ュ瓧浣跨敤鎸囧畾鐨勫鎺ュ瓧宸ュ巶绫诲皢瀵艰嚧浣跨敤java.net.Socket鍒涘缓鐨勫鎺ュ瓧绫�, 榛樿鍊间负true
-     */
-    private boolean socketFactoryFallback;
-    /**
-     * 鎸囧畾鐨勭鍙h繛鎺ュ埌鍦ㄤ娇鐢ㄦ寚瀹氱殑濂楁帴瀛楀伐鍘傘�傚鏋滄病鏈夎缃�,灏嗕娇鐢ㄩ粯璁ょ鍙�
-     */
-    private int socketFactoryPort = 465;
-
-    /**
-     * SMTP瓒呮椂鏃堕暱锛屽崟浣嶆绉掞紝缂虹渷鍊间笉瓒呮椂
-     */
-    private long timeout;
-    /**
-     * Socket杩炴帴瓒呮椂鍊硷紝鍗曚綅姣锛岀己鐪佸�间笉瓒呮椂
-     */
-    private long connectionTimeout;
-    /**
-     * Socket鍐欏嚭瓒呮椂鍊硷紝鍗曚綅姣锛岀己鐪佸�间笉瓒呮椂
-     */
-    private long writeTimeout;
-
-    /**
-     * 鑷畾涔夌殑鍏朵粬灞炴�э紝姝よ嚜瀹氫箟灞炴�т細瑕嗙洊榛樿灞炴��
-     */
-    private final Map<String, Object> customProperty = new HashMap<>();
-
-    // -------------------------------------------------------------- Constructor start
-
-    /**
-     * 鏋勯��,鎵�鏈夊弬鏁伴渶鑷瀹氫箟鎴栦繚鎸侀粯璁ゅ��
-     */
-    public MailAccount() {
-    }
-
-    /**
-     * 鏋勯��
-     *
-     * @param settingPath 閰嶇疆鏂囦欢璺緞
-     */
-    public MailAccount(String settingPath) {
-        this(new Setting(settingPath));
-    }
-
-    /**
-     * 鏋勯��
-     *
-     * @param setting 閰嶇疆鏂囦欢
-     */
-    public MailAccount(Setting setting) {
-        setting.toBean(this);
-    }
-
-    // -------------------------------------------------------------- Constructor end
-
-    /**
-     * 鑾峰緱SMTP鏈嶅姟鍣ㄥ煙鍚�
-     *
-     * @return SMTP鏈嶅姟鍣ㄥ煙鍚�
-     */
-    public String getHost() {
-        return host;
-    }
-
-    /**
-     * 璁剧疆SMTP鏈嶅姟鍣ㄥ煙鍚�
-     *
-     * @param host SMTP鏈嶅姟鍣ㄥ煙鍚�
-     * @return this
-     */
-    public MailAccount setHost(String host) {
-        this.host = host;
-        return this;
-    }
-
-    /**
-     * 鑾峰緱SMTP鏈嶅姟绔彛
-     *
-     * @return SMTP鏈嶅姟绔彛
-     */
-    public Integer getPort() {
-        return port;
-    }
-
-    /**
-     * 璁剧疆SMTP鏈嶅姟绔彛
-     *
-     * @param port SMTP鏈嶅姟绔彛
-     * @return this
-     */
-    public MailAccount setPort(Integer port) {
-        this.port = port;
-        return this;
-    }
-
-    /**
-     * 鏄惁闇�瑕佺敤鎴峰悕瀵嗙爜楠岃瘉
-     *
-     * @return 鏄惁闇�瑕佺敤鎴峰悕瀵嗙爜楠岃瘉
-     */
-    public Boolean isAuth() {
-        return auth;
-    }
-
-    /**
-     * 璁剧疆鏄惁闇�瑕佺敤鎴峰悕瀵嗙爜楠岃瘉
-     *
-     * @param isAuth 鏄惁闇�瑕佺敤鎴峰悕瀵嗙爜楠岃瘉
-     * @return this
-     */
-    public MailAccount setAuth(boolean isAuth) {
-        this.auth = isAuth;
-        return this;
-    }
-
-    /**
-     * 鑾峰彇鐢ㄦ埛鍚�
-     *
-     * @return 鐢ㄦ埛鍚�
-     */
-    public String getUser() {
-        return user;
-    }
-
-    /**
-     * 璁剧疆鐢ㄦ埛鍚�
-     *
-     * @param user 鐢ㄦ埛鍚�
-     * @return this
-     */
-    public MailAccount setUser(String user) {
-        this.user = user;
-        return this;
-    }
-
-    /**
-     * 鑾峰彇瀵嗙爜
-     *
-     * @return 瀵嗙爜
-     */
-    public String getPass() {
-        return pass;
-    }
-
-    /**
-     * 璁剧疆瀵嗙爜
-     *
-     * @param pass 瀵嗙爜
-     * @return this
-     */
-    public MailAccount setPass(String pass) {
-        this.pass = pass;
-        return this;
-    }
-
-    /**
-     * 鑾峰彇鍙戦�佹柟锛岄伒寰猂FC-822鏍囧噯
-     *
-     * @return 鍙戦�佹柟锛岄伒寰猂FC-822鏍囧噯
-     */
-    public String getFrom() {
-        return from;
-    }
-
-    /**
-     * 璁剧疆鍙戦�佹柟锛岄伒寰猂FC-822鏍囧噯<br>
-     * 鍙戜欢浜哄彲浠ユ槸浠ヤ笅褰㈠紡锛�
-     *
-     * <pre>
-     * 1. user@xxx.xx
-     * 2.  name &lt;user@xxx.xx&gt;
-     * </pre>
-     *
-     * @param from 鍙戦�佹柟锛岄伒寰猂FC-822鏍囧噯
-     * @return this
-     */
-    public MailAccount setFrom(String from) {
-        this.from = from;
-        return this;
-    }
-
-    /**
-     * 鏄惁鎵撳紑璋冭瘯妯″紡锛岃皟璇曟ā寮忎細鏄剧ず涓庨偖浠舵湇鍔″櫒閫氫俊杩囩▼锛岄粯璁や笉寮�鍚�
-     *
-     * @return 鏄惁鎵撳紑璋冭瘯妯″紡锛岃皟璇曟ā寮忎細鏄剧ず涓庨偖浠舵湇鍔″櫒閫氫俊杩囩▼锛岄粯璁や笉寮�鍚�
-     * @since 4.0.2
-     */
-    public boolean isDebug() {
-        return debug;
-    }
-
-    /**
-     * 璁剧疆鏄惁鎵撳紑璋冭瘯妯″紡锛岃皟璇曟ā寮忎細鏄剧ず涓庨偖浠舵湇鍔″櫒閫氫俊杩囩▼锛岄粯璁や笉寮�鍚�
-     *
-     * @param debug 鏄惁鎵撳紑璋冭瘯妯″紡锛岃皟璇曟ā寮忎細鏄剧ず涓庨偖浠舵湇鍔″櫒閫氫俊杩囩▼锛岄粯璁や笉寮�鍚�
-     * @return this
-     * @since 4.0.2
-     */
-    public MailAccount setDebug(boolean debug) {
-        this.debug = debug;
-        return this;
-    }
-
-    /**
-     * 鑾峰彇瀛楃闆嗙紪鐮�
-     *
-     * @return 缂栫爜锛屽彲鑳戒负{@code null}
-     */
-    public Charset getCharset() {
-        return charset;
-    }
-
-    /**
-     * 璁剧疆瀛楃闆嗙紪鐮侊紝姝ら�夐」涓嶄細淇敼鍏ㄥ眬閰嶇疆锛岃嫢淇敼鍏ㄥ眬閰嶇疆锛岃璁剧疆姝ら」涓簕@code null}骞惰缃細
-     * <pre>
-     * 	System.setProperty("mail.mime.charset", charset);
-     * </pre>
-     *
-     * @param charset 瀛楃闆嗙紪鐮侊紝{@code null} 鍒欒〃绀轰娇鐢ㄥ叏灞�璁剧疆鐨勯粯璁ょ紪鐮侊紝鍏ㄥ眬缂栫爜涓簃ail.mime.charset绯荤粺灞炴��
-     * @return this
-     */
-    public MailAccount setCharset(Charset charset) {
-        this.charset = charset;
-        return this;
-    }
-
-    /**
-     * 瀵逛簬瓒呴暱鍙傛暟鏄惁鍒囧垎涓哄浠斤紝榛樿涓篺alse锛堝浗鍐呴偖绠遍檮浠朵笉鏀寔鍒囧垎鐨勯檮浠跺悕锛�
-     *
-     * @return 瀵逛簬瓒呴暱鍙傛暟鏄惁鍒囧垎涓哄浠�
-     */
-    public boolean isSplitlongparameters() {
-        return splitlongparameters;
-    }
-
-    /**
-     * 璁剧疆瀵逛簬瓒呴暱鍙傛暟鏄惁鍒囧垎涓哄浠斤紝榛樿涓篺alse锛堝浗鍐呴偖绠遍檮浠朵笉鏀寔鍒囧垎鐨勯檮浠跺悕锛�<br>
-     * 娉ㄦ剰姝ら」涓哄叏灞�璁剧疆锛屾椤逛細璋冪敤
-     * <pre>
-     * System.setProperty("mail.mime.splitlongparameters", true)
-     * </pre>
-     *
-     * @param splitlongparameters 瀵逛簬瓒呴暱鍙傛暟鏄惁鍒囧垎涓哄浠�
-     */
-    public void setSplitlongparameters(boolean splitlongparameters) {
-        this.splitlongparameters = splitlongparameters;
-    }
-
-    /**
-     * 瀵逛簬鏂囦欢鍚嶆槸鍚︿娇鐢▄@link #charset}缂栫爜锛岄粯璁や负 {@code true}
-     *
-     * @return 瀵逛簬鏂囦欢鍚嶆槸鍚︿娇鐢▄@link #charset}缂栫爜锛岄粯璁や负 {@code true}
-     * @since 5.7.16
-     */
-    public boolean isEncodefilename() {
-
-        return encodefilename;
-    }
-
-    /**
-     * 璁剧疆瀵逛簬鏂囦欢鍚嶆槸鍚︿娇鐢▄@link #charset}缂栫爜锛屾閫夐」涓嶄細淇敼鍏ㄥ眬閰嶇疆<br>
-     * 濡傛灉姝ら�夐」璁剧疆涓簕@code false}锛屽垯鏄惁缂栫爜鍙栧喅浜庝袱涓郴缁熷睘鎬э細
-     * <ul>
-     *     <li>mail.mime.encodefilename  鏄惁缂栫爜闄勪欢鏂囦欢鍚�</li>
-     *     <li>mail.mime.charset         缂栫爜鏂囦欢鍚嶇殑缂栫爜</li>
-     * </ul>
-     *
-     * @param encodefilename 瀵逛簬鏂囦欢鍚嶆槸鍚︿娇鐢▄@link #charset}缂栫爜
-     * @since 5.7.16
-     */
-    public void setEncodefilename(boolean encodefilename) {
-        this.encodefilename = encodefilename;
-    }
-
-    /**
-     * 鏄惁浣跨敤 STARTTLS瀹夊叏杩炴帴锛孲TARTTLS鏄绾枃鏈�氫俊鍗忚鐨勬墿灞曘�傚畠灏嗙函鏂囨湰杩炴帴鍗囩骇涓哄姞瀵嗚繛鎺ワ紙TLS鎴朣SL锛夛紝 鑰屼笉鏄娇鐢ㄤ竴涓崟鐙殑鍔犲瘑閫氫俊绔彛銆�
-     *
-     * @return 鏄惁浣跨敤 STARTTLS瀹夊叏杩炴帴
-     */
-    public boolean isStarttlsEnable() {
-        return this.starttlsEnable;
-    }
-
-    /**
-     * 璁剧疆鏄惁浣跨敤STARTTLS瀹夊叏杩炴帴锛孲TARTTLS鏄绾枃鏈�氫俊鍗忚鐨勬墿灞曘�傚畠灏嗙函鏂囨湰杩炴帴鍗囩骇涓哄姞瀵嗚繛鎺ワ紙TLS鎴朣SL锛夛紝 鑰屼笉鏄娇鐢ㄤ竴涓崟鐙殑鍔犲瘑閫氫俊绔彛銆�
-     *
-     * @param startttlsEnable 鏄惁浣跨敤STARTTLS瀹夊叏杩炴帴
-     * @return this
-     */
-    public MailAccount setStarttlsEnable(boolean startttlsEnable) {
-        this.starttlsEnable = startttlsEnable;
-        return this;
-    }
-
-    /**
-     * 鏄惁浣跨敤 SSL瀹夊叏杩炴帴
-     *
-     * @return 鏄惁浣跨敤 SSL瀹夊叏杩炴帴
-     */
-    public Boolean isSslEnable() {
-        return this.sslEnable;
-    }
-
-    /**
-     * 璁剧疆鏄惁浣跨敤SSL瀹夊叏杩炴帴
-     *
-     * @param sslEnable 鏄惁浣跨敤SSL瀹夊叏杩炴帴
-     * @return this
-     */
-    public MailAccount setSslEnable(Boolean sslEnable) {
-        this.sslEnable = sslEnable;
-        return this;
-    }
-
-    /**
-     * 鑾峰彇SSL鍗忚锛屽涓崗璁敤绌烘牸鍒嗛殧
-     *
-     * @return SSL鍗忚锛屽涓崗璁敤绌烘牸鍒嗛殧
-     * @since 5.5.7
-     */
-    public String getSslProtocols() {
-        return sslProtocols;
-    }
-
-    /**
-     * 璁剧疆SSL鍗忚锛屽涓崗璁敤绌烘牸鍒嗛殧
-     *
-     * @param sslProtocols SSL鍗忚锛屽涓崗璁敤绌烘牸鍒嗛殧
-     * @since 5.5.7
-     */
-    public void setSslProtocols(String sslProtocols) {
-        this.sslProtocols = sslProtocols;
-    }
-
-    /**
-     * 鑾峰彇鎸囧畾瀹炵幇javax.net.SocketFactory鎺ュ彛鐨勭被鐨勫悕绉�,杩欎釜绫诲皢琚敤浜庡垱寤篠MTP鐨勫鎺ュ瓧
-     *
-     * @return 鎸囧畾瀹炵幇javax.net.SocketFactory鎺ュ彛鐨勭被鐨勫悕绉�, 杩欎釜绫诲皢琚敤浜庡垱寤篠MTP鐨勫鎺ュ瓧
-     */
-    public String getSocketFactoryClass() {
-        return socketFactoryClass;
-    }
-
-    /**
-     * 璁剧疆鎸囧畾瀹炵幇javax.net.SocketFactory鎺ュ彛鐨勭被鐨勫悕绉�,杩欎釜绫诲皢琚敤浜庡垱寤篠MTP鐨勫鎺ュ瓧
-     *
-     * @param socketFactoryClass 鎸囧畾瀹炵幇javax.net.SocketFactory鎺ュ彛鐨勭被鐨勫悕绉�,杩欎釜绫诲皢琚敤浜庡垱寤篠MTP鐨勫鎺ュ瓧
-     * @return this
-     */
-    public MailAccount setSocketFactoryClass(String socketFactoryClass) {
-        this.socketFactoryClass = socketFactoryClass;
-        return this;
-    }
-
-    /**
-     * 濡傛灉璁剧疆涓簍rue,鏈兘鍒涘缓涓�涓鎺ュ瓧浣跨敤鎸囧畾鐨勫鎺ュ瓧宸ュ巶绫诲皢瀵艰嚧浣跨敤java.net.Socket鍒涘缓鐨勫鎺ュ瓧绫�, 榛樿鍊间负true
-     *
-     * @return 濡傛灉璁剧疆涓簍rue, 鏈兘鍒涘缓涓�涓鎺ュ瓧浣跨敤鎸囧畾鐨勫鎺ュ瓧宸ュ巶绫诲皢瀵艰嚧浣跨敤java.net.Socket鍒涘缓鐨勫鎺ュ瓧绫�, 榛樿鍊间负true
-     */
-    public boolean isSocketFactoryFallback() {
-        return socketFactoryFallback;
-    }
-
-    /**
-     * 濡傛灉璁剧疆涓簍rue,鏈兘鍒涘缓涓�涓鎺ュ瓧浣跨敤鎸囧畾鐨勫鎺ュ瓧宸ュ巶绫诲皢瀵艰嚧浣跨敤java.net.Socket鍒涘缓鐨勫鎺ュ瓧绫�, 榛樿鍊间负true
-     *
-     * @param socketFactoryFallback 濡傛灉璁剧疆涓簍rue,鏈兘鍒涘缓涓�涓鎺ュ瓧浣跨敤鎸囧畾鐨勫鎺ュ瓧宸ュ巶绫诲皢瀵艰嚧浣跨敤java.net.Socket鍒涘缓鐨勫鎺ュ瓧绫�, 榛樿鍊间负true
-     * @return this
-     */
-    public MailAccount setSocketFactoryFallback(boolean socketFactoryFallback) {
-        this.socketFactoryFallback = socketFactoryFallback;
-        return this;
-    }
-
-    /**
-     * 鑾峰彇鎸囧畾鐨勭鍙h繛鎺ュ埌鍦ㄤ娇鐢ㄦ寚瀹氱殑濂楁帴瀛楀伐鍘傘�傚鏋滄病鏈夎缃�,灏嗕娇鐢ㄩ粯璁ょ鍙�
-     *
-     * @return 鎸囧畾鐨勭鍙h繛鎺ュ埌鍦ㄤ娇鐢ㄦ寚瀹氱殑濂楁帴瀛楀伐鍘傘�傚鏋滄病鏈夎缃�,灏嗕娇鐢ㄩ粯璁ょ鍙�
-     */
-    public int getSocketFactoryPort() {
-        return socketFactoryPort;
-    }
-
-    /**
-     * 鎸囧畾鐨勭鍙h繛鎺ュ埌鍦ㄤ娇鐢ㄦ寚瀹氱殑濂楁帴瀛楀伐鍘傘�傚鏋滄病鏈夎缃�,灏嗕娇鐢ㄩ粯璁ょ鍙�
-     *
-     * @param socketFactoryPort 鎸囧畾鐨勭鍙h繛鎺ュ埌鍦ㄤ娇鐢ㄦ寚瀹氱殑濂楁帴瀛楀伐鍘傘�傚鏋滄病鏈夎缃�,灏嗕娇鐢ㄩ粯璁ょ鍙�
-     * @return this
-     */
-    public MailAccount setSocketFactoryPort(int socketFactoryPort) {
-        this.socketFactoryPort = socketFactoryPort;
-        return this;
-    }
-
-    /**
-     * 璁剧疆SMTP瓒呮椂鏃堕暱锛屽崟浣嶆绉掞紝缂虹渷鍊间笉瓒呮椂
-     *
-     * @param timeout SMTP瓒呮椂鏃堕暱锛屽崟浣嶆绉掞紝缂虹渷鍊间笉瓒呮椂
-     * @return this
-     * @since 4.1.17
-     */
-    public MailAccount setTimeout(long timeout) {
-        this.timeout = timeout;
-        return this;
-    }
-
-    /**
-     * 璁剧疆Socket杩炴帴瓒呮椂鍊硷紝鍗曚綅姣锛岀己鐪佸�间笉瓒呮椂
-     *
-     * @param connectionTimeout Socket杩炴帴瓒呮椂鍊硷紝鍗曚綅姣锛岀己鐪佸�间笉瓒呮椂
-     * @return this
-     * @since 4.1.17
-     */
-    public MailAccount setConnectionTimeout(long connectionTimeout) {
-        this.connectionTimeout = connectionTimeout;
-        return this;
-    }
-
-    /**
-     * 璁剧疆Socket鍐欏嚭瓒呮椂鍊硷紝鍗曚綅姣锛岀己鐪佸�间笉瓒呮椂
-     *
-     * @param writeTimeout Socket鍐欏嚭瓒呮椂鍊硷紝鍗曚綅姣锛岀己鐪佸�间笉瓒呮椂
-     * @return this
-     * @since 5.8.3
-     */
-    public MailAccount setWriteTimeout(long writeTimeout) {
-        this.writeTimeout = writeTimeout;
-        return this;
-    }
-
-    /**
-     * 鑾峰彇鑷畾涔夊睘鎬у垪琛�
-     *
-     * @return 鑷畾涔夊弬鏁板垪琛�
-     * @since 5.6.4
-     */
-    public Map<String, Object> getCustomProperty() {
-        return customProperty;
-    }
-
-    /**
-     * 璁剧疆鑷畾涔夊睘鎬э紝濡俶ail.smtp.ssl.socketFactory
-     *
-     * @param key   灞炴�у悕锛岀┖鐧借蹇界暐
-     * @param value 灞炴�у�硷紝 null琚拷鐣�
-     * @return this
-     * @since 5.6.4
-     */
-    public MailAccount setCustomProperty(String key, Object value) {
-        if (StrUtil.isNotBlank(key) && ObjectUtil.isNotNull(value)) {
-            this.customProperty.put(key, value);
-        }
-        return this;
-    }
-
-    /**
-     * 鑾峰緱SMTP鐩稿叧淇℃伅
-     *
-     * @return {@link Properties}
-     */
-    public Properties getSmtpProps() {
-        //鍏ㄥ眬绯荤粺鍙傛暟
-        System.setProperty(SPLIT_LONG_PARAMS, String.valueOf(this.splitlongparameters));
-
-        final Properties p = new Properties();
-        p.put(MAIL_PROTOCOL, "smtp");
-        p.put(SMTP_HOST, this.host);
-        p.put(SMTP_PORT, String.valueOf(this.port));
-        p.put(SMTP_AUTH, String.valueOf(this.auth));
-        if (this.timeout > 0) {
-            p.put(SMTP_TIMEOUT, String.valueOf(this.timeout));
-        }
-        if (this.connectionTimeout > 0) {
-            p.put(SMTP_CONNECTION_TIMEOUT, String.valueOf(this.connectionTimeout));
-        }
-        // issue#2355
-        if (this.writeTimeout > 0) {
-            p.put(SMTP_WRITE_TIMEOUT, String.valueOf(this.writeTimeout));
-        }
-
-        p.put(MAIL_DEBUG, String.valueOf(this.debug));
-
-        if (this.starttlsEnable) {
-            //STARTTLS鏄绾枃鏈�氫俊鍗忚鐨勬墿灞曘�傚畠灏嗙函鏂囨湰杩炴帴鍗囩骇涓哄姞瀵嗚繛鎺ワ紙TLS鎴朣SL锛夛紝 鑰屼笉鏄娇鐢ㄤ竴涓崟鐙殑鍔犲瘑閫氫俊绔彛銆�
-            p.put(STARTTLS_ENABLE, "true");
-
-            if (null == this.sslEnable) {
-                //涓轰簡鍏煎鏃х増鏈紝褰撶敤鎴锋病鏈夋椤归厤缃椂锛屾寜鐓tarttlsEnable寮�鍚姸鎬佹椂瀵瑰緟
-                this.sslEnable = true;
-            }
-        }
-
-        // SSL
-        if (null != this.sslEnable && this.sslEnable) {
-            p.put(SSL_ENABLE, "true");
-            p.put(SOCKET_FACTORY, socketFactoryClass);
-            p.put(SOCKET_FACTORY_FALLBACK, String.valueOf(this.socketFactoryFallback));
-            p.put(SOCKET_FACTORY_PORT, String.valueOf(this.socketFactoryPort));
-            // issue#IZN95@Gitee锛屽湪Linux涓嬮渶鑷畾涔塖SL鍗忚鐗堟湰
-            if (StrUtil.isNotBlank(this.sslProtocols)) {
-                p.put(SSL_PROTOCOLS, this.sslProtocols);
-            }
-        }
-
-        // 琛ュ厖鑷畾涔夊睘鎬э紝鍏佽鑷畾灞炴�ц鐩栧凡缁忚缃殑鍊�
-        p.putAll(this.customProperty);
-
-        return p;
-    }
-
-    /**
-     * 濡傛灉鏌愪簺鍊间负null锛屼娇鐢ㄩ粯璁ゅ��
-     *
-     * @return this
-     */
-    public MailAccount defaultIfEmpty() {
-        // 鍘绘帀鍙戜欢浜虹殑濮撳悕閮ㄥ垎
-        final String fromAddress = InternalMailUtil.parseFirstAddress(this.from, this.charset).getAddress();
-
-        if (StrUtil.isBlank(this.host)) {
-            // 濡傛灉SMTP鍦板潃涓虹┖锛岄粯璁や娇鐢╯mtp.<鍙戜欢浜洪偖绠卞悗缂�>
-            this.host = StrUtil.format("smtp.{}", StrUtil.subSuf(fromAddress, fromAddress.indexOf('@') + 1));
-        }
-        if (StrUtil.isBlank(user)) {
-            // 濡傛灉鐢ㄦ埛鍚嶄负绌猴紝榛樿涓哄彂浠朵汉锛坕ssue#I4FYVY@Gitee锛�
-            //this.user = StrUtil.subPre(fromAddress, fromAddress.indexOf('@'));
-            this.user = fromAddress;
-        }
-        if (null == this.auth) {
-            // 濡傛灉瀵嗙爜闈炵┖鐧斤紝鍒欎娇鐢ㄨ璇佹ā寮�
-            this.auth = (false == StrUtil.isBlank(this.pass));
-        }
-        if (null == this.port) {
-            // 绔彛鍦⊿SL鐘舵�佷笅榛樿涓巗ocketFactoryPort涓�鑷达紝闈濻SL鐘舵�佷笅榛樿涓�25
-            this.port = (null != this.sslEnable && this.sslEnable) ? this.socketFactoryPort : 25;
-        }
-        if (null == this.charset) {
-            // 榛樿UTF-8缂栫爜
-            this.charset = CharsetUtil.CHARSET_UTF_8;
-        }
-
-        return this;
-    }
-
-    @Override
-    public String toString() {
-        return "MailAccount [host=" + host + ", port=" + port + ", auth=" + auth + ", user=" + user + ", pass=" + (StrUtil.isEmpty(this.pass) ? "" : "******") + ", from=" + from + ", startttlsEnable="
-            + starttlsEnable + ", socketFactoryClass=" + socketFactoryClass + ", socketFactoryFallback=" + socketFactoryFallback + ", socketFactoryPort=" + socketFactoryPort + "]";
-    }
-}
diff --git a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailException.java b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailException.java
deleted file mode 100644
index cc199d4..0000000
--- a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.dromara.common.mail.utils;
-
-import cn.hutool.core.exceptions.ExceptionUtil;
-import cn.hutool.core.util.StrUtil;
-
-import java.io.Serial;
-
-/**
- * 閭欢寮傚父
- *
- * @author xiaoleilu
- */
-public class MailException extends RuntimeException {
-    @Serial
-    private static final long serialVersionUID = 8247610319171014183L;
-
-    public MailException(Throwable e) {
-        super(ExceptionUtil.getMessage(e), e);
-    }
-
-    public MailException(String message) {
-        super(message);
-    }
-
-    public MailException(String messageTemplate, Object... params) {
-        super(StrUtil.format(messageTemplate, params));
-    }
-
-    public MailException(String message, Throwable throwable) {
-        super(message, throwable);
-    }
-
-    public MailException(String message, Throwable throwable, boolean enableSuppression, boolean writableStackTrace) {
-        super(message, throwable, enableSuppression, writableStackTrace);
-    }
-
-    public MailException(Throwable throwable, String messageTemplate, Object... params) {
-        super(StrUtil.format(messageTemplate, params), throwable);
-    }
-}
diff --git a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailUtils.java b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailUtils.java
index 040cc57..a28701f 100644
--- a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailUtils.java
+++ b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/MailUtils.java
@@ -5,6 +5,9 @@
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.CharUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.extra.mail.JakartaMail;
+import cn.hutool.extra.mail.JakartaUserPassAuthenticator;
+import cn.hutool.extra.mail.MailAccount;
 import jakarta.mail.Authenticator;
 import jakarta.mail.Session;
 import lombok.AccessLevel;
@@ -17,7 +20,7 @@
 import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-
+import java.util.Map.Entry;
 
 /**
  * 閭欢宸ュ叿绫�
@@ -385,7 +388,7 @@
     public static Session getSession(MailAccount mailAccount, boolean isSingleton) {
         Authenticator authenticator = null;
         if (mailAccount.isAuth()) {
-            authenticator = new UserPassAuthenticator(mailAccount.getUser(), mailAccount.getPass());
+            authenticator = new JakartaUserPassAuthenticator(mailAccount.getUser(), mailAccount.getPass());
         }
 
         return isSingleton ? Session.getDefaultInstance(mailAccount.getSmtpProps(), authenticator) //
@@ -412,7 +415,7 @@
      */
     private static String send(MailAccount mailAccount, boolean useGlobalSession, Collection<String> tos, Collection<String> ccs, Collection<String> bccs, String subject, String content,
                                Map<String, InputStream> imageMap, boolean isHtml, File... files) {
-        final Mail mail = Mail.create(mailAccount).setUseGlobalSession(useGlobalSession);
+        final JakartaMail mail = JakartaMail.create(mailAccount).setUseGlobalSession(useGlobalSession);
 
         // 鍙�夋妱閫佷汉
         if (CollUtil.isNotEmpty(ccs)) {
@@ -431,7 +434,7 @@
 
         // 鍥剧墖
         if (MapUtil.isNotEmpty(imageMap)) {
-            for (Map.Entry<String, InputStream> entry : imageMap.entrySet()) {
+            for (Entry<String, InputStream> entry : imageMap.entrySet()) {
                 mail.addImage(entry.getKey(), entry.getValue());
                 // 鍏抽棴娴�
                 IoUtil.close(entry.getValue());
@@ -463,5 +466,4 @@
         return result;
     }
     // ------------------------------------------------------------------------------------------------------------------------ Private method end
-
 }
diff --git a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/UserPassAuthenticator.java b/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/UserPassAuthenticator.java
deleted file mode 100644
index fbbe5e3..0000000
--- a/ruoyi-common/ruoyi-common-mail/src/main/java/org/dromara/common/mail/utils/UserPassAuthenticator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.dromara.common.mail.utils;
-
-import jakarta.mail.Authenticator;
-import jakarta.mail.PasswordAuthentication;
-
-/**
- * 鐢ㄦ埛鍚嶅瘑鐮侀獙璇佸櫒
- *
- * @author looly
- * @since 3.1.2
- */
-public class UserPassAuthenticator extends Authenticator {
-
-    private final String user;
-    private final String pass;
-
-    /**
-     * 鏋勯��
-     *
-     * @param user 鐢ㄦ埛鍚�
-     * @param pass 瀵嗙爜
-     */
-    public UserPassAuthenticator(String user, String pass) {
-        this.user = user;
-        this.pass = pass;
-    }
-
-    @Override
-    protected PasswordAuthentication getPasswordAuthentication() {
-        return new PasswordAuthentication(this.user, this.pass);
-    }
-
-}

--
Gitblit v1.9.3