Issue
I am trying to run spring boot web app at Linux VPS (Debian 10 release).
I am using JavaMail api for building and sending welcome messages when users sing up to the page.
Works perfectly when running locally at windows 10 machine, using tomcat 9.
After deploying to the VPS tomcat 9, exception occurs when trying to send a mail.
There is stacktrace:
[2020-04-02 16:49:34] [info]
org.springframework.mail.MailSendException: Mail server connection
failed; nested exception is com.sun.mail.util.MailConnectException:
Couldn't connect to host, port: mail.mydomain.hr, 587; timeout -1;
[2020-04-02 16:49:34] [info] nested exception is: [2020-04-02
16:49:34] [info] #011java.net.ConnectException: Connection timed out
(Connection timed out). Failed messages:
com.sun.mail.util.MailConnectException: Couldn't connect to host,
port: mail.mydomain.hr, 587; timeout -1;
There are application.properties
spring.mail.host=mail.mydomain.hr
spring.mail.port=587
[email protected]
spring.mail.password=mypass
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true
Any ideas how to fix this?
Solution
Solved by these two steps:
Changed VPS rDNS to mydomain.hr - (I am not sure if this was necessary)
Contacted my support to restart firewall and it is working now. So it was firewall problem.
Answered By - spalatrin