I am using gmail as my testing mail server to test Java Mail code.
Here is my test code:
But as I run this test code, it throw exception as bellows:
We need to enables the use of the STARTTLS command to switch the connection to a TLS-protected connection before issuing any login commands.
Therefore, the source code would be modified as following:
Test successful !