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

New Post: How get all messages from all folders?

$
0
0
Hi,
i am using the latest build of ImapX, and i wanted to get messages and attachments from all folders

That is my code, i can get all folders, but messages not. How to get messages?
if (client.Login(login, pass))
                {
                    // login successful
                    FolderCollection folders = client.Folders;
                    foreach (Folder myfolder in folders)
                    {

                        var messages = myfolder.Messages;

                        foreach (var message in messages)
                        {
                            MessageBox.Show(message.Subject);
                            var attachments = message.Attachments;
                            if (attachments.Count() > 0)
                                foreach (var attachment in attachments)
                                {
                                    MessageBox.Show(attachment.FileName);
                                }
                        }
                    }
                }

Viewing all articles
Browse latest Browse all 1952

Trending Articles



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