Delphi DLL
Delphi DLL
Explicitly Connect to the POP3 Server
See more POP3 Examples
Demonstrates the Chilkat MailMan.Pop3Connect method, which explicitly connects to the POP3 server. If SSL/TLS is required by the current property settings, the secure TLS channel is established as part of connecting. This example opens the connection.
Background:
Pop3Connect performs just the connect (and TLS handshake) step, without authenticating. Separating it from Pop3Authenticate gives explicit control over the session lifecycle and makes it easy to tell a connection failure apart from a login failure. For routine mailbox operations you don't need it — methods like CheckMail connect automatically.Chilkat Delphi DLL Downloads
var
success: Boolean;
mailman: HCkMailMan;
begin
success := False;
// Demonstrates the MailMan.Pop3Connect method, which explicitly connects to the POP3 server.
// If SSL/TLS is required by the current property settings, the secure channel is established
// as part of connecting.
mailman := CkMailMan_Create();
// Configure the POP3 server connection.
CkMailMan_putMailHost(mailman,'pop.example.com');
CkMailMan_putMailPort(mailman,995);
CkMailMan_putPopSsl(mailman,True);
// Explicitly connect to the POP3 server (does not authenticate).
success := CkMailMan_Pop3Connect(mailman);
if (success = False) then
begin
Memo1.Lines.Add(CkMailMan__lastErrorText(mailman));
Exit;
end;
Memo1.Lines.Add('Connected to the POP3 server.');
CkMailMan_Dispose(mailman);