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

Read To and Cc from a received message

See more Email Object Examples

Enumerate visible recipients by zero-based index. An address can have an empty display name. A delivered copy usually does not reveal recipients who were blind-copied.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoEmail
    Integer i
    String sTemp1
    String sTemp2

    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 "message.eml" To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoEmail To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Move 0 To i
    While (i < (ComNumTo(hoEmail)))
        Get ComGetToName Of hoEmail i To sTemp1
        Get ComGetToAddr Of hoEmail i To sTemp2
        Showln "To: " sTemp1 "  " sTemp2
        Move (i + 1) To i
    Loop

    Move 0 To i
    While (i < (ComNumCC(hoEmail)))
        Get ComGetCcName Of hoEmail i To sTemp1
        Get ComGetCcAddr Of hoEmail i To sTemp2
        Showln "Cc: " sTemp1 "  " sTemp2
        Move (i + 1) To i
    Loop



End_Procedure