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.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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