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

Export HTML and related files into a directory

See more Email Object Examples

Choose a separate directory for each message. UnpackHtml writes the HTML file, exports its related resources, and rewrites links to their local paths. This is useful when images should remain separate files.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoEmail
    String sTemp1
    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 "inline-image.eml" To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoEmail To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComHasHtmlBody Of hoEmail To bTemp1
    If (bTemp1 <> True) Begin
        Showln "This message has no HTML body."
        Procedure_Return
    End

    Get ComUnpackHtml Of hoEmail "workshop-preview" "index.html" "images" To iSuccess
    If (iSuccess <> True) Begin
        Get ComLastErrorText Of hoEmail To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln "Saved workshop-preview/index.html and its related files."


End_Procedure