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)

Hi,

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,
client.GetMailMessage(message.SequenceNumber);

Applies to: Rebex Secure Mail

1 Answer

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

Hello,

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 Feb 21 by Deep (120 points)
As I have shared link of StackOverflow, What do you suggest?
commented Feb 21 by Lukas Pokorny (92,230 points)
Thanks, I'm afraid I was not quite sure what you wanted to achieve, but it's all clear now - see my reply at StackOverflow. It looks like setting Imap object's Settings.UsePeekForGetMessage to 'true' is what you need.
commented Feb 21 by Deep (120 points)
Ty so much!! U made my day.

Just last question, after I successfully get the mailing details, How can I update email status to seen?
commented Feb 21 by Lukas Pokorny (92,230 points)
imap.SetMessageFlags(unique_key, ImapFlagAction.Add, ImapMessageFlags.Seen);
commented Feb 21 by Deep (120 points)
Ty Lukas for helping me to understand rebex.
...