Spring Boot 1.2.5.RELEASE - Sending E-mail via Gmail SMTP

后端 未结 2 693
时光取名叫无心
时光取名叫无心 2020-12-09 16:39

Firstly, I need to say that sending email with 1.2.0.RELEASE works fine

application.properties:

spring.         


        
相关标签:
2条回答
  • 2020-12-09 17:00

    It looks like it is a regression. I have created #3624 to investigate the issue. Thanks for the sample project!

    0 讨论(0)
  • 2020-12-09 17:13

    It looks like there's a regression/behaviour change in Java Mail. The change is in both 1.5.3 and 1.5.4. Your app works with Boot 1.2.0 as it uses Java Mail 1.5.2. It fails with Boot 1.2.5 as it uses Java Mail 1.5.4.

    The problem in 1.5.3+ appears to be that the SMTP transport connects on port 465 and GMail expects an SSL handshake. Java Mail incorrectly thinks it's not using SSL so it never initiates the handshake and the connection attempt (eventually) times out. You can convince Java Mail to do the right thing by being explicit about the use of SSL. Add the following to application.properties:

    spring.mail.properties.mail.smtp.ssl.enable = true
    
    0 讨论(0)
提交回复
热议问题