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

Transition from Imap.FetchSingleHeader to Imap.FetchEmail

Provides instructions for replacing deprecated FetchSingleHeader method calls with FetchEmail.

Chilkat Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
imap: HCkImap;
emailObj: HCkEmail;
headerOnly: Boolean;
emailOut: HCkEmail;

begin
success := False;

imap := CkImap_Create();

//  ...
//  ...

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

emailObj := CkImap_FetchSingleHeader(imap,1,False);
if (CkImap_getLastMethodSuccess(imap) = False) then
  begin
    Memo1.Lines.Add(CkImap__lastErrorText(imap));
    Exit;
  end;

//  ...
//  ...

CkEmail_Dispose(emailObj);

//  ------------------------------------------------------------------------
//  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 := True;

emailOut := CkEmail_Create();
success := CkImap_FetchEmail(imap,headerOnly,1,False,emailOut);
if (success = False) then
  begin
    Memo1.Lines.Add(CkImap__lastErrorText(imap));
    Exit;
  end;

CkImap_Dispose(imap);
CkEmail_Dispose(emailOut);