Will I get mail details from my next sequence number, when I get "The server has closed the connection-ImapException"?

0 votes
asked Nov 30, 2017 by Deep (120 points)


I refer many articles and they say that this is server side issue !! But, I want to know that while retrieving details of sequence number 1 to 100, I got an error in 55th sequence number. So after moving further, would it also generate an error for retrieving email information for 56th sequence number?

I am using method,

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Nov 30, 2017 by stepantalalayev (3,220 points)


once the connection is closed, calling any method will cause an exception. The suggested solution is to dispose old client object and create new one and connect again. Then you can continue in your process.

commented Dec 7, 2017 by Deep (120 points)
Thanks for information,

What is difference between unique key and sequence number?  Both are unique identity in email? Consider 1 to 100 unseen email,  if I delete 50th unread email then would it be formatted through 1 to 99?
commented Dec 7, 2017 by stepantalalayev (3,220 points)
Unique key is persisted over sessions (more precisely until folder validity is changed, which is very rare on most servers - check https://tools.ietf.org/html/rfc4549#section-4.1 for more details).

Sequence number is unique for current session only. Moreover it can be changed at any time by the server (e.g. when messages are deleted or so) - this implies, it is better to not use it at all.