File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes IMAP connection failed. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "IMAP connection failed." Watch "IMAP connection failed." New topic

IMAP connection failed.

evelyn ong

Joined: Aug 03, 2010
Posts: 13

I am trying to connect to mail server using IMAP, however sometime i do get the following errors:

javax.mail.MessagingException: * BYE Disconnected for inactivity.

How do i overcome the problem? Is there a way to keep the connection alive?
gx glix

Joined: Mar 08, 2011
Posts: 2
Hi evelyn, what are you doing that takes so long after opening an imap folder?

I usually open the folder scan messages parse them insert to db and close the session.
You could create a timer task to do getmessagecount every so often but its just a dirty workaround.
why not design your app to open a connection when needed rather than open and wait for activity

I agree. Here's the link:
subject: IMAP connection failed.
It's not a secret anymore!