Gmail Folder List

Aug 28, 2012 at 9:36 PM

Not having much luck here....

private string sHost = "";
    private int sPort = 993;
    private string uid = @"validuserid";
    private string pwd = @"whatever";

        using (Crystalbyte.Equinox.Imap.ImapClient ic = new Crystalbyte.Equinox.Imap.ImapClient()) {
            ic.Security = SecurityPolicies.Explicit;
            ic.Connect(sHost, sPort);

           if (ic.IsConnected) {
                bool authed = ic.Authenticate(uid, pwd, SaslMechanics.Login);



At this point, authed = false.... however, I am logged in and if i ignore the false, i can make some requests I think.  I could be wrong, and the false is accurate, but I don't think so.

Then, I have tried to get a list of folders, with no luck.....
var mbs = ic.List("","").Mailboxes;
// var mbs = ic.List("INBOX", "").Mailboxes;

                        foreach (var mb in mbs) {
                            litsearchresult.Text += mb.Name + "<br />";
I  never have any folders in the mailboxes list... ?

Aug 29, 2012 at 8:32 AM


I'd suggest using the debug assemblies, for they log all traffic from and to the server in the debug output.



Aug 31, 2012 at 2:23 PM
Edited Aug 31, 2012 at 2:38 PM

Hi jminond,

I had the same problem and found out Gmail works with the XLIST command.

Equinox does not support this command, since it's a Google/Apple thing and not used by others.

I downloaded the source and created two functions, List and XList, which both use the current List functionality, passing XLIST as the command for XList and LIST as the command for List, 

Compile that to a new DLL and reference that. Now you can call yourImapClientInstance.XList("", "*") to retrieve the Gmail 'folders' properly.

See ImapClient.cs line 727 for the default List implementation.