This project is read-only.

No folders retrieved

Topics: Help requests, Issues
Jun 26, 2014 at 3:16 PM
Edited Jun 26, 2014 at 3:17 PM
Hello,

I'm simply trying to download all available message, but unfortunatly the Folders IEnumerable is not getting populated. Here's my code. c.Folders is empty, the connection succeeds.
var c = new ImapX.ImapClient("doman");
c.Credentials = new PlainCredentials("usr","pswd");
c.Connect();
foreach (var f in c.Folders)
{
    f.Messages.Download();
    foreach (var m in f.Messages)
    {
        Console.WriteLine(m.Subject);
    }
}
Coordinator
Jun 27, 2014 at 2:05 PM
Hi saphua,

change your code as following:
var c = new ImapX.ImapClient("doman");

if(c.Connect())
{
      if(c.Login("user", "password"))
      {      
            foreach (var f in c.Folders)
            {
                  f.Messages.Download();
                  foreach (var m in f.Messages)
                  {
                        Console.WriteLine(m.Subject);
                  }
            }
      }
}
The Connect method only does what it says - connecting to the server. In order to login, you need to call the Login method.

Greets,

Pavel