Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Get the POP3 UIDL of an Email
See more Email Object Examples
Demonstrates the read-only Chilkat Email.Uidl property, which contains the unique message identifier assigned by a POP3 server; the value is also represented by the X-UIDL header field. This example sets X-UIDL directly to illustrate how it maps to the Uidl property (normally the value comes from the POP3 server during download).
Background: A UIDL ("unique ID listing") is POP3's stable identifier for a message in a mailbox — it stays the same across sessions, so a client can remember which messages it has already downloaded and avoid fetching them again. Note this is POP3-specific: IMAP uses its own UID instead, which Chilkat stores in the
ckx-imap-uid header rather than in Uidl.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.Email;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
email: TEmail;
begin
// Demonstrates the read-only Email.Uidl property, which contains the unique message
// identifier assigned by a POP3 server. The value is represented by the X-UIDL header
// field. Here we set X-UIDL directly to show how it maps to the Uidl property.
email := TEmail.Create;
// Normally the POP3 server assigns this; we set it here for demonstration.
email.AddHeaderField('X-UIDL','0000000123abcdef');
WriteLn('Uidl = ' + email.Uidl);
email.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.