Sample code for 30+ languages & platforms
CkPython

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 CkPython Downloads

CkPython
import sys
import chilkat

success = False

mime = chilkat.CkMime()
success = mime.SetBodyFromPlainText("Message body.")
if (success == False):
    print(mime.lastErrorText())
    sys.exit()

#  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.
mime.put_CmsOptions("{}")

#  UnwrapExtras controls whether UnwrapSecurity adds informative header fields describing the
#  security layers it removed.  The default is True.
mime.put_UnwrapExtras(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.
mime.put_UncommonOptions("")

print("CmsOptions = " + mime.cmsOptions())
print("Advanced options configured.")