Delphi DLL
Delphi DLL
Explicitly Begin a POP3 Session
See more POP3 Examples
Demonstrates the Chilkat MailMan.Pop3BeginSession method, which explicitly begins a POP3 session by connecting to the POP3 server and authenticating using the current POP3 property settings. Calling it is optional. This example begins a session, performs a mailbox operation, and ends the session.
Background:
Pop3BeginSession combines connecting and authenticating into one call. Chilkat does this automatically when a mailbox operation needs it, so the value of calling it explicitly is control: you open one session, perform several operations against it, and close it with Pop3EndSession — avoiding repeated connect/authenticate round trips and keeping deletion marks within a single, well-defined session.Chilkat Delphi DLL Downloads
var
success: Boolean;
mailman: HCkMailMan;
begin
success := False;
// Demonstrates the MailMan.Pop3BeginSession method, which explicitly begins a POP3 session
// by connecting to the POP3 server and authenticating using the current POP3 property
// settings.
mailman := CkMailMan_Create();
// Configure the POP3 server connection.
CkMailMan_putMailHost(mailman,'pop.example.com');
CkMailMan_putMailPort(mailman,995);
CkMailMan_putPopSsl(mailman,True);
CkMailMan_putPopUsername(mailman,'user@example.com');
CkMailMan_putPopPassword(mailman,'myPassword');
// Explicitly begin the POP3 session (connect + authenticate).
success := CkMailMan_Pop3BeginSession(mailman);
if (success = False) then
begin
Memo1.Lines.Add(CkMailMan__lastErrorText(mailman));
Exit;
end;
// Perform one or more mailbox operations within this single session.
Memo1.Lines.Add('Mailbox count: ' + IntToStr(CkMailMan_GetMailboxCount(mailman)));
// End the session when finished.
success := CkMailMan_Pop3EndSession(mailman);
if (success = False) then
begin
Memo1.Lines.Add(CkMailMan__lastErrorText(mailman));
Exit;
end;
Memo1.Lines.Add('POP3 session completed.');
CkMailMan_Dispose(mailman);