Delphi ActiveX Requires Chilkat v11.0.0+
Delphi ActiveX
Attach an existing EML as a message/rfc822 part
See more Email Object Examples
Load the saved message and attach a copy as a nested email. Recipients can open the nested headers, bodies, and attachments. Using an Email object avoids native byte-array differences across languages.
Chilkat Delphi ActiveX Downloads
var
success: Integer;
original: TChilkatEmail;
email: TChilkatEmail;
begin
success := 0;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
original := TChilkatEmail.Create(Self);
success := original.LoadEml('message.eml');
if (success <> 1) then
begin
Memo1.Lines.Add(original.LastErrorText);
Exit;
end;
email := TChilkatEmail.Create(Self);
email.From := 'Workshop team <events@example.com>';
success := email.AddTo('Alex Rivera','alex@example.net');
if (success <> 1) then
begin
Memo1.Lines.Add(email.LastErrorText);
Exit;
end;
email.Subject := 'Registration correspondence';
email.Body := 'The original message is attached for reference.';
success := email.AttachEmail(original.ControlInterface);
if (success <> 1) then
begin
Memo1.Lines.Add(email.LastErrorText);
Exit;
end;
Memo1.Lines.Add('Nested messages: ' + IntToStr(email.NumAttachedMessages));
success := email.SaveEml('correspondence.eml');
if (success <> 1) then
begin
Memo1.Lines.Add(email.LastErrorText);
Exit;
end;
Memo1.Lines.Add('Saved correspondence.eml.');