If you are using javax.mail APIs and provided correct credentials for your Gmail account and still getting “javax.mail.AuthenticationFailedException: [AUTHENTICATIONFAILED] Invalid credentials (Failure)” error then there are high chances that you might have forgotten to relax the security of your Gmail account. You can use this link to allow less secure apps to access your Gmail (which obviously makes your account vulnerable and thus isn’t recommended) https://myaccount.google.com/lesssecureapps?pli=1
A blog about my testing stories where I pen down my thoughts about test automation covering primarily Selenium, Java, Rest Assured, Karate, Maven, TestNG, Postman, newman, Jenkins, Git, Azure DevOps, etc.