Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Clear the POP3 Session Log
See more POP3 Examples
Demonstrates the Chilkat MailMan.ClearPop3SessionLog method, which clears the current contents of the Pop3SessionLog property. This example performs a POP3 operation (which populates the log) and then clears it.
Background: The
Pop3SessionLog accumulates the raw protocol conversation — the commands Chilkat sent and the server's replies — which is invaluable for diagnosing connection or authentication problems. When performing many operations on one MailMan object, the log grows continuously; ClearPop3SessionLog resets it so you can capture just the exchange for the next operation.Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.MailMan;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
mailman: TMailMan;
count: Integer;
begin
// Demonstrates the MailMan.ClearPop3SessionLog method, which clears the current contents of
// the Pop3SessionLog property.
mailman := TMailMan.Create;
// Configure the POP3 server connection.
mailman.MailHost := 'pop.example.com';
mailman.MailPort := 995;
mailman.PopSsl := True;
mailman.PopUsername := 'user@example.com';
mailman.PopPassword := 'myPassword';
// Perform a POP3 operation, which populates the session log.
count := mailman.GetMailboxCount();
WriteLn('Mailbox count: ' + count);
// Clear the POP3 session log (for example, before the next operation).
mailman.ClearPop3SessionLog();
WriteLn('POP3 session log cleared.');
// Note: Explicitly connecting/authenticating is optional. Chilkat MailMan automatically
// connects and authenticates -- using the property settings above -- whenever a server
// operation requires it. Calling the explicit connect/authenticate methods can still be
// helpful to determine whether a failure occurs while connecting or while authenticating.
mailman.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.