1.导入所需要的依赖
<dependency>
<groupId>javax.mail</groupId>
<artifactId>javax.mail-api</artifactId>
<version>1.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.simplejavamail/simple-java-mail -->
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>simple-java-mail</artifactId>
<version>5.0.8</version>
</dependency>
2、了解邮件发送过程(了解相关协议SMTP和POP3等协议)
3、进行邮件服务器的相关设置(开启授权码登录)
nihai
4、编写客户端代码
/* 发送邮件*/
public void sendMail(String address) throws Exception {
Properties properties = new Properties();
// 开启debug调试,以便在控制台查看
properties.setProperty("mail.debug", "true");
// 设置邮件服务器主机名
properties.setP