SSLException in using JavaMail API

孤街浪徒 提交于 2019-12-06 16:18:59

You're connecting to port 25 and using SSL. Port 25 is the non-SSL (plain text) port. Assuming your server is set up for SSL, use the connect method that doesn't require you to specify a port number and let JavaMail use the default port.

The SSL configuration of your SMTP server would be the first thing i'd check. If your class works with the external services then it's a security configuration of your server.

Kyle Clegg

You are probably getting that error because you did not create a signed cert on the server side. If you did set up the SSL verification, you either did not do it correctly or you are connecting to a server whose cert hasn't been added to the truststore.

This post ( How Can I Access an SSL Connection Through Android? ) has an answer with a code sample as to how you can initialize your keystore and truststore.

Java Mail API causes a lot of problems, here are my working examples for various pop3/smtp connections, which I recently tested with few different mail servers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!