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

Transition from MailMan.LoadXmlEmail to Email.SetFromXmlText

Provides instructions for replacing deprecated LoadXmlEmail method calls with Email.SetFromXmlText.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
var
success: Integer;
mailman: TChilkatMailMan;
xmlFilePath: WideString;
emailObj: IChilkatEmail;
sb: TChilkatStringBuilder;
email: TChilkatEmail;

begin
success := 0;

mailman := TChilkatMailMan.Create(Self);

//  ...
//  ...

xmlFilePath := 'c:/test/example.xml';

//  ------------------------------------------------------------------------
//  The LoadXmlEmail method is deprecated:

emailObj := mailman.LoadXmlEmail(xmlFilePath);
if (mailman.LastMethodSuccess = 0) then
  begin
    Memo1.Lines.Add(mailman.LastErrorText);
    Exit;
  end;

//  ...
//  ...

//  ------------------------------------------------------------------------
//  Do the equivalent using Email.SetFromXmlText.

sb := TChilkatStringBuilder.Create(Self);
success := sb.LoadFile(xmlFilePath,'utf-8');
if (success = 0) then
  begin
    Memo1.Lines.Add(sb.LastErrorText);
    Exit;
  end;

email := TChilkatEmail.Create(Self);
success := email.SetFromXmlText(sb.GetAsString());
if (success = 0) then
  begin
    Memo1.Lines.Add(email.LastErrorText);
    Exit;
  end;