JavaMail API : Username and Password not accepted (Gmail)

前端 未结 2 1159
不知归路
不知归路 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 09:18

    To be able send mail messages via your gmail account, you should allow unsecure applications (which your application is by gmail's point of view) in google account security settings.

    UPD: Also, if you want to see debug messages, use next java mail property:

    props.put("mail.debug", "true");
    

    It can help you to find out what happening behind the scenes.

提交回复
热议问题