Sample code for 30+ languages & platforms
Delphi ActiveX

Transition from Imap.FetchSingle to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingle method calls with FetchEmail.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
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;
end;