Sample code for 30+ languages & platforms
Delphi ActiveX Requires Chilkat v11.0.0+

Pass an Email object to the MIME API

See more Email Object Examples

Serialize an Email into a fresh BinData buffer and load those bytes into Mime to inspect the tree. Keep the original file separately when byte-for-byte preservation matters, such as for DKIM verification.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
var
success: Integer;
email: TChilkatEmail;
mimeBytes: TChilkatBinData;
mime: TChilkatMime;

begin
success := 0;

//  Assumes Chilkat is unlocked. See Global Unlock Sample.

email := TChilkatEmail.Create(Self);
success := email.LoadEml('message.eml');
if (success <> 1) then
  begin
    Memo1.Lines.Add(email.LastErrorText);
    Exit;
  end;
mimeBytes := TChilkatBinData.Create(Self);
success := email.GetMimeBd(mimeBytes.ControlInterface);
if (success <> 1) then
  begin
    Memo1.Lines.Add(email.LastErrorText);
    Exit;
  end;
mime := TChilkatMime.Create(Self);
success := mime.LoadMimeBd(mimeBytes.ControlInterface);
if (success <> 1) then
  begin
    Memo1.Lines.Add(mime.LastErrorText);
    Exit;
  end;
Memo1.Lines.Add(mime.GetStructure('text'));