Connecting to an IMAP server

ImapX allows you to specify the server, port and encryption in three different ways:

Initializing the client

No SSL, default port (143) for connection

var client = new ImapClient("imap.server.com");

SSL, default port (993) for connection

var client = new ImapClient("imap.server.com", true); 

SSL, default port (993) for connection, disable certificate validation

var client = new ImapClient("imap.server.com", true, false); 

No SSL, custom port for connection

var client = new ImapClient("imap.server.com", 888);

SSL, custom port for connection

var client = new ImapClient("imap.server.com", 888, true); 

SSL, custom port for connection, disable certificate validation

var client = new ImapClient("imap.server.com", 888, true, false);

TLS, custom port for connection, disable certificate validation

var client = new ImapClient("imap.server.com", 888, SslProtocols.Tls, false); 

Connecting

if(client.Connect( /* optional, use parameters here */ )) {
     // connection successful
}
else {
     // connection not successful
}

Next