Malik
Malik

Reputation: 207

How to automatically get new mails from gmail account using java?

I know my question is more likely to be discussed rather than really answered (because it's very large), but I need some elements and "advices" to really get started, sorry for that.

So I've got a java program which has to analyse some URLs, I've finished this part. For the moment, the user has to enter manually the link into my program, then the link is analysed.

Now I have to retrieve automatically those links, which will be sent to me via e-mail. (In a special Gmail inbox created for that purpose)

So I need to :

There are many problems, according to the way I choose to access to my inbox (POP3, GMail API...), according to the frequency my application would check the inbox, maybe there would be authentification problems... Even how to let my application run as a "daemon"...

And I really don't know how to get started, which choices to make etc.

Any help is welcome of course, if you have any documentation or else. Thank you in advance.

Upvotes: 1

Views: 2048

Answers (1)

jfcorugedo
jfcorugedo

Reputation: 10059

You have several ways of doing this.

I suggest you using Java Mail, that has a simple and useful API.

You have some documentation and examples in this URL:

https://java.net/projects/javamail/pages/Home#Samples

Look at the class monitor (very bad name!!!) inside the examples. This class monitor a mail box for new emails.

Upvotes: 3

Related Questions