CkPython Requires Chilkat v11.0.0+
CkPython
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 CkPython Downloads
import sys
import chilkat
success = False
# Assumes Chilkat is unlocked. See Global Unlock Sample.
email = chilkat.CkEmail()
success = email.LoadEml("delivery-status.eml")
if (success != True):
print(email.lastErrorText())
sys.exit()
if (email.IsMultipartReport() != True):
print("This message is not a multipart report.")
sys.exit()
if (email.GetNumPartsOfType("message/delivery-status",False,False) == 0):
print("No delivery-status part in this report.")
sys.exit()
if (email.HasPlainTextBody() == True):
print(email.getPlainTextBody())
details = chilkat.CkJsonObject()
success = email.GetDsnInfo(details)
if (success != True):
print(email.lastErrorText())
sys.exit()
details.put_EmitCompact(False)
print(details.emit())