Spring boot - sending emails with Logback

前端 未结 3 1491
栀梦
栀梦 2020-12-29 04:12

I am trying to configure Logback to send emails whenever an exception (Logging level: ERROR) occurs. I have not been able to make it work so far so I would like to ask for y

3条回答
  •  北海茫月
    2020-12-29 04:38

    Default entry for port in smtpappender is 25, gmail is using authentication for smtp services, and you need use ports 587 for TLS and 465 for SSL.

    I would say this might be your problem.

    Try to setup mail server on your local machine first without authentication, and try is your appended works. then try to find how to configure it for gmail.

    From page http://logback.qos.ch/manual/appenders.html#gmailSTARTTLS

    SMTPAppender for Gmail (STARTTLS)

       
      
        smtp.gmail.com
        587
        true
        YOUR_USERNAME@gmail.com
        YOUR_GMAIL_xPASSWORD
        
        EMAIL-DESTINATION
        ANOTHER_EMAIL_DESTINATION 
        YOUR_USERNAME@gmail.com
        TESTING: %logger{20} - %m
        
          %date %-5level %logger - %message%n
               
      
    
      
        
        
    
    

提交回复
热议问题