springboot admin邮件报警

来源:互联网 发布:枪神纪刷枪软件 免费 编辑:程序博客网 时间:2024/05/29 19:00

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: XXXX@qq.com  #收件人邮箱

          from: XXXX@qq.com  #发件人邮箱

  mail:  

    host: smtp.XX.com  #(私人邮箱测试,企业邮箱和私人邮箱配置不同)

    username: XXXX@qq.com #登录账号

    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.启动项目

登录邮箱->自助查询

 

 

 

原创粉丝点击