You're trying to connect to smtp.gmail.com on port 465, which is an SSL port, but JavaMail doesn't think you want to use SSL. You're probably failing in the SSL protocol negotiation. Something is wrong with how you're setting the configuration for the JavaMail Session that you're using.