springboot admin邮件报警
Springboot admin邮件报警
springboot admin(sba)监管eureka注册中心的各个服务,服务启动或down时,给制定人员发送报警邮件
1.引入依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
2.登录邮箱->设置->账户->开启IMAP/SMTP服务
3.配置yaml文件
Spring
boot:
admin:
notify:
mail:
to: [email protected] #收件人邮箱
from: [email protected] #发件人邮箱
mail:
host: smtp.XX.com #(私人邮箱测试,企业邮箱和私人邮箱配置不同)
username: [email protected] #登录账号
password: xxxxxxxxxxxx #密码(开启IMAP/SMTP服务颁发的授权码)
properties:
mail.debug: false
mail.smtp.auth: true #安全认证(默认是true)
mail.smtp.port: 465
mail.smtp.ssl.enable: true #开启ssl加密 否则项目启动时报530error
mail.smtp.ssl.socketFactory: sf
4.启动项目
登录邮箱->自助查询