0 votes

I am able to connect to the IMAP successfully. Looks like below code is not able to pull out the email as per UID.

IMail email = new MailBuilder().CreateFromEml(imap.GetMessageByUID(uid));

Any suggestions !!!

by
What error are you getting? Any Exception? What is the message and stack trace?
No Error. No exception. It just taking almost 5 mins (or longer time) to get the email.
Maybe the email is huge? Please turn on logging:
www.limilabs.com/blog/logging-in-mail-dll

Which method takes that long Imap.GetMessageByUID -or- Imap.CreateFromEml:

var eml = imap.GetMessageByUID(uid)
IMail email = new MailBuilder().CreateFromEml(eml);
var eml = imap.GetMessageByUID(uid);

Above line of code after some time gives below message in o/p window:

The thread '<No Name>' (0x1ec8) has exited with code 0 (0x0).

This is taking more time.
Please use try...catch to catch any exceptions.
M using try...catch blocks in the code. No errors No exceptions as such ...
Then the method has not finished running.
OK. Thanks for all your help !!!

1 Answer

0 votes

Please examine error message carefully. Remember to use Imap.Select or Imap.SelectInbox before you try to get any messages.

Most likely the UID you try to use doesn't exist in the selected folder anymore.

Imap.GetMessageByUID is one of the core methods of Mail.dll .NET IMAP client, there is almost no chance it works incorrectly.

by (297k points)
I do use imap.SelectInbox();
...