Question

Sending mail from my droplet via javax.mail

Hi! I want to send a email from a DOCKER CONTAINER which runs a Java-Rest-API running on my Droplet. I’m using javax.mail to send emails. It works on my local Windows machine. But i get this error when running it on my ubuntu droplet: [ERROR@EMAIL] - javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; nested exception is: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)

Starting and creating my docker container with these commands:

  • mvn package -Dquarkus.native.container-build=true -DskipTests
  • docker build -f src/main/docker/Dockerfile.jvm -t pservice .
  • docker run --name pservice -i --rm -p 8080:8080 -d pservice
  • docker logs pservice -f

do i need to do something like -p 25:25? or -p 465:465?

What could be the problem? I already asked the support to open up the SMTP Ports for me, they did it. But it still won’t work.

Subscribe
Share

Nevermind, I did it. Probably the problem was on quarkus’s-Side. Everyone who’s searching for a solution: https://quarkus.io/guides/mailer

^ This is absolute fire.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

According to the error you are using port 465 so as long as this port is open it should be alright.

You could test if this is the case for your server by running the following telnet command:

telnet smtp.gmail.com 465

Also, I think that the problem is with the ciphers as you are getting an SSL error.

You could try removing TLSv1 and TLSv1.1 from the file $JAVA_HOME/conf/security and give it another try.

Let me know how it goes. Regards, Bobby