diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml
index fb50aa34..230c9667 100644
--- a/ruoyi-common/pom.xml
+++ b/ruoyi-common/pom.xml
@@ -113,8 +113,8 @@
- com.sun.mail
- jakarta.mail
+ jakarta.mail
+ jakarta.mail-api
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/email/MailUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/email/MailUtils.java
index 32a3f825..a3ed32d0 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/email/MailUtils.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/email/MailUtils.java
@@ -11,8 +11,8 @@ import com.ruoyi.common.utils.spring.SpringUtils;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import javax.mail.Authenticator;
-import javax.mail.Session;
+import jakarta.mail.Authenticator;
+import jakarta.mail.Session;
import java.io.File;
import java.io.InputStream;
import java.util.Collection;
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/email/UserPassAuthenticator.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/email/UserPassAuthenticator.java
new file mode 100644
index 00000000..d3e0fc84
--- /dev/null
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/email/UserPassAuthenticator.java
@@ -0,0 +1,33 @@
+package com.ruoyi.common.utils.email;
+
+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);
+ }
+
+}