0
votes

I'm trying to fetch 50 mails or so and then call GetMessage() in a foreach loop, but it took a long time! Is there any way to speed up getting message in mailkit? here is my code:

  var mailItems = folder.Fetch(startRange, endRange,MessageSummaryItems.UniqueId);

            foreach (var item in mailItems)
            {
                var message = folder.GetMessage(item.UniqueId);
            }

after using dotTrace profiling tools for Yahoo Mails the results are as follows:

dotTrace profiling result

1
Get a faster internet connection? - jstedfast
But the Internet connection is fast enough to perform such function - Saeideh Hemmati
Isn't there any way to optimize the code? - Saeideh Hemmati
How long does it take and how long do you expect it to take? What is the basis for your expectation? - jstedfast
What is the latency between your computer and the server? - jstedfast

1 Answers

0
votes

You could try using a profiling tool such as dotTrace to try and find performance bottlenecks that you could fix to make it faster.

That's what performance profilers are for.