如果喜欢我的编程笔记可以关注我的微信公众号【Java掌上手册】,上面有我不定期的项目面试题分享哦~(关注公众号回复面试宝典便可获得史上最全的后端面试题资料哦!)
1.pom依赖
<!-- 集成email-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
2.application.yml配置
spring:
mail:
# 配置 SMTP 服务器地址
host: smtp.qq.com
# 发送者邮箱
username: 你的邮箱
# 配置密码,注意不是真正的密码,而是刚刚申请到的授权码
password: 你的授权码
# 端口号465或587
port: 587
# 默认的邮件编码为UTF-8
default-encoding: UTF-8