Sample code for 30+ languages & platforms
DataFlex

Get the Entire Serialized MIME Body

See more MIME Examples

Demonstrates the Chilkat Mime.GetEntireBody method, which returns the complete serialized body of the current entity. It takes no arguments. For multipart MIME this includes the boundary delimiters and each child part's headers and body.

Note: The file paths are relative to the application's current working directory. Absolute paths may also be used. Supply the paths appropriate to your own environment.

Background: This returns everything below the entity's own headers — for a simple part, just the body; for a multipart, the whole nested structure with its boundaries and child headers. It pairs with GetEntireHead, which returns the header section, so together they let you inspect or reconstruct a message's two halves separately.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoMime
    String sEntireBody
    String sTemp1
    Boolean bTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatMime)) To hoMime
    If (Not(IsComObjectCreated(hoMime))) Begin
        Send CreateComObject of hoMime
    End
    Get ComLoadMimeFile Of hoMime "qa_data/message.eml" To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoMime To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    //  Return the complete serialized body of the current entity.  For multipart MIME, this includes
    //  the boundary delimiters and each child part's headers and body, but not the entity's own top
    //  headers.
    Get ComGetEntireBody Of hoMime To sEntireBody
    Get ComLastMethodSuccess Of hoMime To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoMime To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Showln sEntireBody


End_Procedure