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

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoEmail
    Variant vDetails
    Handle hoDetails
    String sTemp1
    Integer iTemp1
    Boolean bTemp1

    Move False To iSuccess

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

    Get Create (RefClass(cComChilkatEmail)) To hoEmail
    If (Not(IsComObjectCreated(hoEmail))) Begin
        Send CreateComObject of hoEmail
    End
    Get ComLoadEml Of hoEmail "delivery-status.eml" To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoEmail To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComIsMultipartReport Of hoEmail To bTemp1
    If (bTemp1 <> True) Begin
        Showln "This message is not a multipart report."
        Procedure_Return
    End

    Get ComGetNumPartsOfType Of hoEmail "message/delivery-status" False False To iTemp1
    If (iTemp1 = 0) Begin
        Showln "No delivery-status part in this report."
        Procedure_Return
    End

    Get ComHasPlainTextBody Of hoEmail To bTemp1
    If (bTemp1 = True) Begin
        Get ComGetPlainTextBody Of hoEmail To sTemp1
        Showln sTemp1
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoDetails
    If (Not(IsComObjectCreated(hoDetails))) Begin
        Send CreateComObject of hoDetails
    End
    Get pvComObject of hoDetails to vDetails
    Get ComGetDsnInfo Of hoEmail vDetails To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoEmail To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Set ComEmitCompact Of hoDetails To False
    Get ComEmit Of hoDetails To sTemp1
    Showln sTemp1


End_Procedure