SpringBoot-动态的改变邮箱发送人

283 阅读1分钟

动态的改变邮箱发送人

核心思想是:修改JavaMailSenderImpl类的 username 和 password

public class JavaMailSenderImpl implements JavaMailSender {

	/** The default protocol: 'smtp'. */
	public static final String DEFAULT_PROTOCOL = "smtp";

	/** The default port: -1. */
	public static final int DEFAULT_PORT = -1;

	private static final String HEADER_MESSAGE_ID = "Message-ID";


	private Properties javaMailProperties = new Properties();

	@Nullable
	private Session session;

	@Nullable
	private String protocol;

	@Nullable
	private String host;

	private int port = DEFAULT_PORT;

	@Nullable
	private String username;

	@Nullable
	private String password;

	@Nullable
	private String defaultEncoding;

	@Nullable
	private FileTypeMap defaultFileTypeMap;
	
}