Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Load MIME Object from Email Object
See more Email Object Examples
Demonstrates how to load a Chilkat Mime object from a Chilkat Email object. (Copies the email into a Mime object.)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.Mime,
Chilkat.StringBuilder,
Chilkat.Email;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
email: TEmail;
sbMime: TStringBuilder;
mime: TMime;
begin
success := False;
email := TEmail.Create;
success := email.LoadEml('qa_data/eml/sample.eml');
// Write the full MIME of the email to a StringBuilder.
sbMime := TStringBuilder.Create;
email.GetMimeSb(sbMime);
// Load the MIME object from the StringBuilder
mime := TMime.Create;
success := mime.LoadMimeSb(sbMime);
WriteLn(mime.GetMime());
email.Free;
sbMime.Free;
mime.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.