Delphi DLL Requires Chilkat v11.0.0+
Delphi DLL
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 DLL Downloads
var
success: Boolean;
email: HCkEmail;
fields: HCkXml;
originalId: PWideChar;
report: HCkEmail;
begin
success := False;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
email := CkEmail_Create();
success := CkEmail_LoadEml(email,'message.eml');
if (success <> True) then
begin
Memo1.Lines.Add(CkEmail__lastErrorText(email));
Exit;
end;
fields := CkXml_Create();
CkXml_putTag(fields,'DispositionFields');
CkXml_NewChild2(fields,'Final-Recipient','rfc822; alex@example.net');
originalId := CkEmail__getHeaderField(email,'Message-ID');
if (originalId <> '') then
begin
CkXml_NewChild2(fields,'Original-Message-ID',originalId);
end;
CkXml_NewChild2(fields,'Disposition','manual-action/MDN-sent-manually; displayed');
report := CkEmail_Create();
success := CkEmail_ToMdn(email,'The recipient displayed your message.',CkXml__getXml(fields),True,report);
if (success <> True) then
begin
Memo1.Lines.Add(CkEmail__lastErrorText(email));
Exit;
end;
CkEmail_putFrom(report,'Alex Rivera <alex@example.net>');
success := CkEmail_SaveEml(report,'disposition.eml');
if (success <> True) then
begin
Memo1.Lines.Add(CkEmail__lastErrorText(report));
Exit;
end;
Memo1.Lines.Add('Saved disposition.eml.');
CkEmail_Dispose(email);
CkXml_Dispose(fields);
CkEmail_Dispose(report);