JavaMail Exception javax.mail.AuthenticationFailedException 534-5.7.9 Application-specific password required

You have enabled Two phase authentication for your Google account and as a result applications will not be able to login to your Google account using the actual password. Google expects you to generate a application specific password for each application you use (and give it a name) and then use that password to login to your Google account from your application. This allows you to not give your password to third party application when you have 2-step authentication enabled.

The alternate way is for your application to support redirecting to a Google page to authenticate using username and password and code generated by the Google Authenticator app.

The link clearly explains what to do.