配置文件application.yml
spring:
#安全配置
security:
user:
name: admin
password: admin
boot:
admin:
ui:
title: 服务监控中心
notify:
mail:
to: 511594105@qq.com #提醒人的邮箱
from: 邮箱地址@163.com #你的邮箱(同上面登录的邮箱名)
mail:
port: 25
protocol: smtp
host: smtp.163.com
username: 邮箱地址@163.com #登录的邮箱名
password: 123456 #登录的邮箱密码、授权码
properties:
mail:
debug: false
smtp:
auth: true #安全认证(默认是true)
ssl:
enable: false
trust: '*'
starttls:
enable: true
required: true
添加依赖pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<!--邮件依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>