Search code examples
springspring-bootjakarta-mail

Spring Boot mail error


The following error shows in Eclipse

Caused by: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 25;


<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-mail</artifactId>
</dependency>

app properties:

spring.mail.host = smtp.gmail.com
spring.mail.username [email protected]
spring.mail.password =**********************
spring.mail.properties.mail.smtp.auth = true
spring.mail.properties.mail.smtp.socketFactory.port = 587
spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.smtp.socketFactory.fallback = false
[email protected]
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true

I have tried everything: deactivated antivirus, enabled less secure changing port to 465 or 25 without result.


Solution

  • The solution is to desactivate avast before runing the application, but now how can i make it running without disabling avast regulary.