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

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 PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

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

$email = new COM("Chilkat.Email");
$success = $email->LoadEml('delivery-status.eml');
if ($success != 1) {
    print $email->LastErrorText . "\n";
    exit;
}

if ($email->IsMultipartReport() != 1) {
    print 'This message is not a multipart report.' . "\n";
    exit;
}

if ($email->GetNumPartsOfType('message/delivery-status',0,0) == 0) {
    print 'No delivery-status part in this report.' . "\n";
    exit;
}

if ($email->HasPlainTextBody() == 1) {
    print $email->getPlainTextBody() . "\n";
}

$details = new COM("Chilkat.JsonObject");
$success = $email->GetDsnInfo($details);
if ($success != 1) {
    print $email->LastErrorText . "\n";
    exit;
}

$details->EmitCompact = 0;
print $details->emit() . "\n";

?>