C++ Requires Chilkat v11.0.0+
C++
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 C++ Downloads
#include <CkEmail.h>
#include <CkJsonObject.h>
void ChilkatSample(void)
{
bool success = false;
// Assumes Chilkat is unlocked. See Global Unlock Sample.
CkEmail email;
success = email.LoadEml("delivery-status.eml");
if (success != true) {
std::cout << email.lastErrorText() << "\r\n";
return;
}
if (email.IsMultipartReport() != true) {
std::cout << "This message is not a multipart report." << "\r\n";
return;
}
if (email.GetNumPartsOfType("message/delivery-status",false,false) == 0) {
std::cout << "No delivery-status part in this report." << "\r\n";
return;
}
if (email.HasPlainTextBody() == true) {
std::cout << email.getPlainTextBody() << "\r\n";
}
CkJsonObject details;
success = email.GetDsnInfo(details);
if (success != true) {
std::cout << email.lastErrorText() << "\r\n";
return;
}
details.put_EmitCompact(false);
std::cout << details.emit() << "\r\n";
}