JavaMail API : Username and Password not accepted (Gmail)

前端 未结 2 1155
不知归路
不知归路 2020-12-20 08:36

I want to send email from my java application to gmail account I used the following code and javaMail API ,But Gmail not accepted username and password and exception thrown

2条回答
  •  执念已碎
    2020-12-20 08:56

    You can try to allow unsecure applications, it worked for me.

    Steps for Gmail account :

    1. Sign in to Gmail
    2. Click here to access Less Secure App Access in My Account.
    3. Next to “Allow less secure apps: OFF,” select the toggle switch to turn ON.

    See this link for Gmail and G-Suite.

提交回复
热议问题