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

Create a message disposition notification

See more Email Object Examples

An MDN describes a recipient-side event such as displaying a message. Create one only when the application has an appropriate request and the recipient has consented. Set Final-Recipient from the actual receiving mailbox. MDN format.

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
var
success: Integer;
email: TChilkatEmail;
fields: TChilkatXml;
originalId: WideString;
report: TChilkatEmail;

begin
success := 0;

//  Assumes Chilkat is unlocked. See Global Unlock Sample.

email := TChilkatEmail.Create(Self);
success := email.LoadEml('message.eml');
if (success <> 1) then
  begin
    Memo1.Lines.Add(email.LastErrorText);
    Exit;
  end;
fields := TChilkatXml.Create(Self);
fields.Tag := 'DispositionFields';
fields.NewChild2('Final-Recipient','rfc822; alex@example.net');
originalId := email.GetHeaderField('Message-ID');
if (originalId <> '') then
  begin
    fields.NewChild2('Original-Message-ID',originalId);
  end;
fields.NewChild2('Disposition','manual-action/MDN-sent-manually; displayed');
report := TChilkatEmail.Create(Self);
success := email.ToMdn('The recipient displayed your message.',fields.GetXml(),1,report.ControlInterface);
if (success <> 1) then
  begin
    Memo1.Lines.Add(email.LastErrorText);
    Exit;
  end;
report.From := 'Alex Rivera <alex@example.net>';

success := report.SaveEml('disposition.eml');
if (success <> 1) then
  begin
    Memo1.Lines.Add(report.LastErrorText);
    Exit;
  end;
Memo1.Lines.Add('Saved disposition.eml.');