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

Transition from Imap.FetchSingleHeader to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingleHeader method calls with FetchEmail.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
var
success: Integer;
imap: TChilkatImap;
emailObj: IChilkatEmail;
headerOnly: Integer;
emailOut: TChilkatEmail;

begin
success := 0;

imap := TChilkatImap.Create(Self);

//  ...
//  ...

//  ------------------------------------------------------------------------
//  The FetchSingleHeader method is deprecated:

emailObj := imap.FetchSingleHeader(1,0);
if (imap.LastMethodSuccess = 0) then
  begin
    Memo1.Lines.Add(imap.LastErrorText);
    Exit;
  end;

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using FetchEmail.
//  Your application creates a new, empty Email object which is passed 
//  in the last argument and filled upon success.

headerOnly := 1;

emailOut := TChilkatEmail.Create(Self);
success := imap.FetchEmail(headerOnly,1,0,emailOut.ControlInterface);
if (success = 0) then
  begin
    Memo1.Lines.Add(imap.LastErrorText);
    Exit;
  end;