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

Transition from Imap.FetchSingle to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail.

Chilkat Delphi ActiveX Downloads

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

begin
success := 0;

imap := TChilkatImap.Create(Self);

//  ...
//  ...

//  ------------------------------------------------------------------------
//  The FetchSingle method is deprecated:

emailObj := imap.FetchSingle(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 := 0;

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