title: How get all messages from folder in ImapX 2?
body: <p>i am using ImapX 2 and i wanted to get messages and attachments from all folders </p>
  
  <p>That is my code, i can get all folders, but messages not. How to get messages?</p>
  
  <pre><code>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() &gt; 0)
                                  foreach (var attachment in attachments)
                                  {
                                      MessageBox.Show(attachment.FileName);
                                  }
                          }
                      }
                  }
  </code></pre>