Delphi ActiveX Requires Chilkat v11.0.0+
Delphi ActiveX
Read the recipient results in a delivery status report
See more Email Object Examples
Check the report type before reading DSN-specific fields. One report may describe multiple recipients. Retain the per-recipient information in GetDsnInfo instead of assigning one status to every delivery.
Chilkat Delphi ActiveX Downloads
var
success: Integer;
email: TChilkatEmail;
details: TChilkatJsonObject;
begin
success := 0;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
email := TChilkatEmail.Create(Self);
success := email.LoadEml('delivery-status.eml');
if (success <> 1) then
begin
Memo1.Lines.Add(email.LastErrorText);
Exit;
end;
if (email.IsMultipartReport() <> 1) then
begin
Memo1.Lines.Add('This message is not a multipart report.');
Exit;
end;
if (email.GetNumPartsOfType('message/delivery-status',0,0) = 0) then
begin
Memo1.Lines.Add('No delivery-status part in this report.');
Exit;
end;
if (email.HasPlainTextBody() = 1) then
begin
Memo1.Lines.Add(email.GetPlainTextBody());
end;
details := TChilkatJsonObject.Create(Self);
success := email.GetDsnInfo(details.ControlInterface);
if (success <> 1) then
begin
Memo1.Lines.Add(email.LastErrorText);
Exit;
end;
details.EmitCompact := 0;
Memo1.Lines.Add(details.Emit());