Lazarus Pascal Requires Chilkat v11.0.0+
Lazarus Pascal
Read individual messages in a MIME digest
See more Email Object Examples
Use a saved multipart/digest message. NumDigests and GetDigestEmail expose each enclosed message as an Email object. Inspect its own sender and subject instead of assuming all entries share the wrapper’s metadata.
Chilkat Lazarus Pascal 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
success: Boolean;
email: TEmail;
item: TEmail;
i: Integer;
begin
success := False;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
email := TEmail.Create;
success := email.LoadEml('digest.eml');
if (success <> True) then
begin
WriteLn(email.LastErrorText);
Exit;
end;
WriteLn('Digest entries: ' + email.NumDigests);
item := TEmail.Create;
i := 0;
while (i < email.NumDigests) do
begin
success := email.GetDigestEmail(i,item);
if (success <> True) then
begin
WriteLn(email.LastErrorText);
Exit;
end;
WriteLn(i + ' ' + item.FromAddress + ' ' + item.Subject);
i := i + 1;
end;
email.Free;
item.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.