Home » Java » java – How to configure VPS for email sending?-Exceptionshub

java – How to configure VPS for email sending?-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have just bought a VPS with ubuntu server to put there my Spring Boot application with email sending function which worked perfectly on localhost, but when i deployed it on the server it gives me the following exception while trying to send an email

org.springframework.mail.MailAuthenticationException: Authentication
failed; nested exception is javax.mail.AuthenticationFailedException:
534-5.7.14

Configuration for email sending:

spring.mail.host = smtp.gmail.com
spring.mail.properties.mail.smtp.auth = true
spring.mail.properties.mail.smtp.socketFactory.port = 465
spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.smtp.socketFactory.fallback = false

I set less secure apps ON on my google account so probably this is not the source of problem.
I haven’t done any configuration on my Ubuntu server, does anybody know what should I do to solve this problem?

How to&Answers: