Hunny Software Library Reference

Imap4Client.Connect Method

Opens a connection to an IMAP4 server.

Overload List

Opens a connection to an IMAP4 server at the default port.

public void Connect(string);

Opens a connection to an IMAP4 server at a specified port.

public void Connect(string,int);

Remarks

This method opens a connection to the IMAP4 server on the host at network address address and TCP port port. The address parameter may be either a hostname, such as "imap.example.com", or an IP address in dotted decimal form, such as "192.168.2.25". The default value for port is 143, the well-known port number for IMAP4 assigned by the Internet Assigned Numbers Authority (IANA).

If the client fails to connect to the server -- for example, if the host is not found or some other network error occurs -- then Connect throws an instance of Hunny.Mail.Exception. If Connect returns successfully, then you should check the responses from the server. The server sends an untagged OK response if it is ready to process commands. You can check the server's responses by getting the NumResponses property and calling the ResponseAt method.

You may call the Cancel method from another thread to cancel this operation.

Note: The cancel operation will not have an immediate effect if the connect operation is waiting on a hostname lookup. Failed hostname lookups always time out. (In a future implementation, the library may provide the capability to cancel a hostname lookup, as well.)

See Also

Imap4Client Class | Hunny.Mail Namespace