pom依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
测试类
package com.cbb.util;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMessage.RecipientType;
/**
*@date 2022年5月13日 09点02分
*@author 陈斌斌
*/
public class sendEmail {
public static void main(String[] args) throws AddressException,MessagingException {
// 创建Properties 类用于记录邮箱的一些属性
Properties props =