mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 适配 com.sun.mail 更改为 jakarta.mail 修改最新写法
This commit is contained in:
		@@ -113,8 +113,8 @@
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.sun.mail</groupId>
 | 
			
		||||
            <artifactId>jakarta.mail</artifactId>
 | 
			
		||||
            <groupId>jakarta.mail</groupId>
 | 
			
		||||
            <artifactId>jakarta.mail-api</artifactId>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user