wood burning stoves 2.0*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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

jQuery in Action, 2nd edition
subject: IMAP connection failed.
Similar Threads
Reading email messages
Help me please.......
JavaMail API: how to use nonblocking sockets for IMAP?
connect to an IMAP server
Nonblocking socket for IMAP Client