Tag Archives: Project error reporting diary

[Solved] Springboot Project Error: Mail server connection failed;

 

Error background

Using springboot2 Error in 2.0 integrated mail function


Error message:

org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 587;nested exception is:
	javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 587;nested exception is:
	javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
; message exception details (1) are:Failed message 1:
javax.mail.MessagingException: Could not connect to SMTP host: smtp.qq.com, port: 587;
  nested exception is:


Solution:

Modify the configuration file (in the context of using QQ mailbox)

spring:
  mail:
    host: smtp.qq.com
    port: 587
    username: e-mail
    password: Authorization Code
    default-encoding: UTF-8
    properties:
      mail:
        smtp:
          socketFactory:
            class: javax.net.ssl.SSLSocketFactory

result

After modifying the configuration, the problem is solved!