Quantcast
Channel: ImapX 2
Viewing all articles
Browse latest Browse all 1952

New Post: How to fetch only X (a specific number of) emails?

$
0
0
Fetching all e-mails in a folder (inbox, etc) TAKES TOO LONG, event for a few messages (300), so for a 5000 e-mail account the program will either freeze, crash or any other "not-good" situations.
So, my question is:
How to only fetch 10/20 e-mails from a specific folder?
                        List<ImapX.Message> messages = Program.ImapClient.Folders.Inbox.Search().OrderByDescending(x=>x.UId).ToList();

                        for (int i = 0; i < 10; i++ )
                        {
                            MessageBox.Show(messages[i].Subject);
                            String data = messages[i].Date.ToString();
                            flowLayoutPanel1.Controls.Add(new mail1(messages[i].From.ToString(), messages[i].Subject.ToString(), messages[i].Body.Text, data, stdSz));
                        }
This is the code i'm using now, but it still gets all messages from the inbox, and only adds the first 10 to my message list. Any tips?

Viewing all articles
Browse latest Browse all 1952

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>