```
ImapX.ImapClient m_ImapClient = new ImapX.ImapClient( ImapServerAddress, (int) ImapServerPort, System.Security.Authentication.SslProtocols.Ssl3, false);
m_ImapClient.Connect();
m_ImapClient.Login( EmailAddress, EmailPassword);
//the two functions above each return true
//this last statement throws an exception:
ImapX.Collections.FolderCollection vFolders = m_ImapClient.Folders;
```
the code works for imap.google.com on 993. But it does not work for another internal imap server, it connects, it logs in successfully but when I try to the get the Folders member it throws a "null object error". What could be the cause of this?
Comments: ** Comment from web user: ak89 **
This is what it says:
> An unhandled exception of type 'System.NullReferenceException' occurred in ImapX.dll
> Additional information: Object reference not set to an instance of an object.
It breaks in the internal void TryBind(ref Folder folder) on line 24. Because the folder variable is null (don t know why).
I am now trying with this:
```
ImapX.MessageCollection message = client.Folders.Inbox.Messages;
```
ImapX.dll!ImapX.Collections.CommonFolderCollection.TryBind(ref ImapX.Folder folder) Line 24 C#
ImapX.dll!ImapX.ImapClient.GetFolders(string path, ImapX.Collections.CommonFolderCollection commonFolders, ImapX.Folder parent, bool isFirstLevel) Line 135 + 0xd bytes C#
ImapX.dll!ImapX.ImapClient.GetFolders() Line 113 + 0x1b bytes C#
ImapX.dll!ImapX.ImapClient.Folders.get() Line 102 + 0x23 bytes C#
MailApp.exe!MailApp.MailApp._processEmails(object param) C#
```
Thank you,
ak89