1、首先,加入email依赖
<!--mail-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
2、增加配置
spring:
mail:
host: smtp.163.com
username: xxx@163.com
password: 客户端授权码
boot:
admin:
notify:
mail:
enabled: true
to: 要发送的邮箱
from: xxx@163.com