Reading emails from Gmail using IMAP in C# is slow #1820
Replies: 1 comment 2 replies
-
I guess my first question would be to understand your expectations. When you say that it's slow, compared to what? If your expectation is that it should be as fast as any IMAP client populates a message list that you can then select to read a particular email, then that's because you are comparing apples to oranges. Outlook and Thunderbird, for example, do not download every message in order to populate that message list. They only fetch summary information about the messages. You can fetch summary information about the messages, too: var summaries = client.Inbox.Fetch (uids, MessageSummaryItems.Envelope | MessageSummaryItems.Flags); The problem you are facing is that messages themselves can be very large which is slow to download. This is made worse by the fact that you've got a loop that calls You'll notice that most of MailKit's ImapClient/ImapFolder APIs allow batch requests in order to alleviate this issue, but it does not have a |
Beta Was this translation helpful? Give feedback.
-
Hi everyone,
I’m having trouble with retrieving emails using IMAP in C#. Here’s what I’m trying to do:
I’m currently using the MailKit library and the following code:
However, it’s taking a long time to fetch emails, and I’m not sure if I’m doing something wrong.
I’ve already tried limiting the number of messages retrieved.
My internet connection seems fine.
Any advice on optimizing this would be greatly appreciated!
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions