d_void
d_void

Reputation: 123

How to listen for incoming emails on multiple gmail accounts - Java

I want to build a system that listens to new emails on 5 different gmail accounts in JAVA. I read the javax.mail documentation and I found that the javax.mail.session is a static class and I cannot connect to more than one email using it. Is there any way to achieve what I am trying to do in Java or any other language ?

Upvotes: 1

Views: 335

Answers (1)

user207421
user207421

Reputation: 310860

I found that the javax.mail.session is a static class

No you didn't, and no it isn't.

and I cannot connect to more than one email using it

No. You can use a single Session: as noted by @billshannon below (repeating in case of comment cleansing):

You don't need multiple Sessions, but you might find it useful if you need significantly different configuration for different servers. But since you're only connecting to Gmail, that shouldn't be an issue. Each Store can connect with different credentials by calling the appropriate connect() method.

Upvotes: 1

Related Questions