Below is the code that is used to connect and perform operations in the IMAP folder. So my question is about javax.mail.Session , which in this case will recreate every second (depending on the sleep time and checkinbox () execution time).
I am sure this is not a good solution, especially an IMAP poll looks silly, but I could not start an IMAP listener .
Recreating a session not every start may be the best solution, but how do I know when session is closed , or can I close it on purpose? But is there nothing like Session.close() or is it a session than NULL? Or is there a specific timeout on the session ...
Source :
final String port = "993"; Properties prop = new Properties();
In general, I have to say that it is very difficult to find good examples and documentation for javax.mail (besides API and FAQ )
java email imap javamail
Kuchi
source share