5

I was just working on an email program that read emails from Gmail and does further processing. Initially using the code provide in SO(link provided below) I was getting an exception which says that "My access has been blocked and I need to login via web browser".

On the same time I saw an email in inbox (to which I am trying to connect) which says that "Google Account: sign-in attempt blocked" and I need to disable modern security from following link "https://www.google.com/settings/security/lesssecureapps".

I tried to disable and I was succesfully connected.

So does it means that Javamail is a less secure application? Or there are ways by which I can still connect without disabling the option?

Thanks in advance. Garry

[Code I used:]

Community
  • 1
  • 1
Garry
  • 4,493
  • 3
  • 28
  • 48

1 Answers1

4

It's really hard to tell because Google isn't saying exactly what "modern security standards" an app needs to implement to be "more secure", but I suspect they're referring to this blog entry where they talk about OAuth2. JavaMail is capable of using the OAuth2 authentication mechanism, which I guess makes JavaMail a "more secure" application.

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40
  • I'm going to verify your suggestion, thanks. I use the following code to reproduce this problem: Properties props = new Properties(); props.setProperty("mail.store.protocol", "imaps"); Session session = Session.getInstance(props, null); Store store = session.getStore(); store.connect("imap.gmail.com", 993, "*******@gmail.com", "**password**"); – gouessej Jan 22 '16 at 10:50