I am writing a mail sending function by Java Mail API, and using gmail mail server as my smtp server. But as I try to run my testing code, it throw this exception:
You can go to https://support.google.com/accounts/answer/185833 to check the root cause.
Google asks you to generate an application specific password instead of your password.
Then I can send email via gmail mail server successfully.