Sample code for 30+ languages & platforms
DataFlex

MIME Advanced CMS and Compatibility Option Properties

See more MIME Examples

Demonstrates advanced option properties: CmsOptions (a JSON string of advanced CMS/PKCS #7 signing and validation options), UnwrapExtras (whether UnwrapSecurity adds informative header fields describing removed security layers), and UncommonOptions (an option string for uncommon compatibility requirements).

Background. These properties adjust behavior only in specialized situations. Their defaults (empty CmsOptions, UnwrapExtras enabled, empty UncommonOptions) are correct for normal use; UncommonOptions in particular should be set only when directed by support.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoMime
    String sTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatMime)) To hoMime
    If (Not(IsComObjectCreated(hoMime))) Begin
        Send CreateComObject of hoMime
    End
    Get ComSetBodyFromPlainText Of hoMime "Message body." To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoMime To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    //  CmsOptions is a JSON string of advanced CMS/PKCS #7 signing and validation options.  The default
    //  is an empty string, which selects normal behavior.  An empty JSON object {} is also valid.
    Set ComCmsOptions Of hoMime To "{}"

    //  UnwrapExtras controls whether UnwrapSecurity adds informative header fields describing the
    //  security layers it removed.  The default is True.
    Set ComUnwrapExtras Of hoMime To True

    //  UncommonOptions is a semicolon-delimited option string for uncommon compatibility requirements.
    //  Normal applications should leave it empty, and it should only be used when directed by support.
    Set ComUncommonOptions Of hoMime To ""

    Get ComCmsOptions Of hoMime To sTemp1
    Showln "CmsOptions = " sTemp1
    Showln "Advanced options configured."


End_Procedure