Sample code for 30+ languages & platforms
PowerShell 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 PowerShell Downloads

PowerShell
Add-Type -Path "C:\chilkat\ChilkatDotNet47-x64\ChilkatDotNet47.dll"

$success = $false

#  Assumes Chilkat is unlocked. See Global Unlock Sample.

$email = New-Object Chilkat.Email
$success = $email.LoadEml("message.eml")
if ($success -ne $true) {
    $($email.LastErrorText)
    exit
}

$fields = New-Object Chilkat.Xml
$fields.Tag = "DispositionFields"
$fields.NewChild2("Final-Recipient","rfc822; alex@example.net")
$originalId = $email.GetHeaderField("Message-ID")
if ($originalId -ne "") {
    $fields.NewChild2("Original-Message-ID",$originalId)
}

$fields.NewChild2("Disposition","manual-action/MDN-sent-manually; displayed")
$report = New-Object Chilkat.Email
$success = $email.ToMdn("The recipient displayed your message.",$fields.GetXml(),$true,$report)
if ($success -ne $true) {
    $($email.LastErrorText)
    exit
}

$report.From = "Alex Rivera <alex@example.net>"

$success = $report.SaveEml("disposition.eml")
if ($success -ne $true) {
    $($report.LastErrorText)
    exit
}

$("Saved disposition.eml.")