POP3: Initiate the connection (including protected modes)
To connect to a POP3 server you need to create an instance of TElPOP3Client class and setup the needed connection-related properties, such as Address and, optionally, Port. If SSL/TLS protection is used, you need to set UseSSL property to true, and also it's required to create an event handler for OnCertificateValidate event in order to validate certificates of the server. SSLMode property of the POP3 client will define, in which mode (implicit or explicit) SSL/TLS is used (see property description for details).
POP3 protocol uses port 110 for insecure connection and port 995 for secure connection in implicit mode. It's highly recommended to use SSL/TLS to secure the POP3 protocol flow as it sends login credentials in plain text. In Implicit SSL mode, the SSL session is established before any POP3 command is sent. In explicit mode, the SSL session is automatically established before the login credentials are sent.
After the connection is opened, you need to login to the server.
If a connection attempt has been made (no matter successful or not), you need to close the connection.
TElPOP3Client pop3 = new TElPOP3Client(); pop3.Address = "pop.gmail.com"; pop3.Port = 995; // setup SSL parameters pop3.SSLMode = TSBSSLMode.smImplicit; pop3.UseSSL = true; pop3.OnCertificateValidate += new TSBCertificateValidateEvent(...); // open a connection pop3.Open();