CkMime class final
Build, parse, modify, serialize, secure, and inspect MIME and S/MIME data.
Mime provides low-level MIME and S/MIME handling for
applications that need direct control over MIME structure, headers, body
content, encodings, multipart relationships, attachments, and PKCS7/CMS
security layers. It can load, create, inspect, modify, serialize, and save
MIME messages; build multipart structures; manage headers and
content-transfer
encodings; extract attachments; convert MIME to and from XML; and sign,
verify, encrypt, decrypt, or unwrap S/MIME content.
Create and load MIME
Build MIME content programmatically or load existing MIME from strings, files, byte data, or other application sources.
Headers and body content
Read, add, replace, or remove MIME headers, set body content, and control content types, charsets, and transfer encodings.
Multipart structures
Create and inspect multipart MIME trees such as mixed, alternative, related, signed, encrypted, and nested MIME structures.
Attachments and parts
Add, locate, extract, remove, or inspect MIME parts and attachments, including filenames and encoded body data.
S/MIME security
Sign, verify, encrypt, decrypt, unwrap, and inspect PKCS7/CMS S/MIME layers using certificates and private keys.
Serialization and XML
Emit MIME text, save MIME to files, or convert MIME to and from XML for structured inspection, transformation, or storage.
Common pattern:
Use Mime when an application needs low-level control
over MIME parts, headers, encodings, multipart layout, or S/MIME security.
For ordinary email composition and message-level operations, use
Email; use Mime when you need to work
closer to the raw MIME structure.
Initial state: A new Mime object has no headers or child parts. Its
string serialization consists only of the blank header/body separator (CRLF CRLF) until content is added.
MIME parsing is semantic, not byte-preserving. Loading and reserializing can unfold headers, normalize parameter quoting and transfer encodings, use CRLF for generated headers and multipart framing, and discard multipart preamble or epilogue text. Use byte-oriented methods such as loadMimeBd and getMimeBd when arbitrary 8-bit bytes or embedded NUL bytes must be preserved.
For an extended overview, see Mime Class Overview.
A CkMime owns a native Chilkat object. It is released automatically when the
Dart object is garbage collected, or immediately by dispose. Use it only from
the isolate that created it.
- Implemented types
Constructors
- CkMime()
-
Creates a new
CkMimeobject.
Properties
- boundary ↔ String
-
Gets or sets the raw boundary token used by a multipart MIME entity. Do
not include surrounding quotation marks.
getter/setter pair
- charset ↔ String
-
Gets or sets the
charsetparameter of theContent-Typeheader field.getter/setter pair - cmsOptions ↔ String
-
Gets or sets a JSON string containing advanced CMS/PKCS #7 signing and
validation options. The default is an empty string, which selects normal
behavior. A valid empty JSON object may also be supplied as
{}.getter/setter pair - contentType ↔ String
-
Gets or sets the MIME media type of the current part, excluding all
parameters. Supply a value such as
text/plain,text/html,application/pdf, ormultipart/mixed; do not includecharset,boundary, or other parameters in this property.getter/setter pair - currentDateTime → String
-
Returns the current local date and time formatted as an Internet message
date, including the numeric UTC offset. For example:
no setter
- debugLogFilePath ↔ String
-
If set to a file path, this property logs the LastErrorText of each
Chilkat method or property call to the specified file. This logging helps
identify the context and history of Chilkat calls leading up to any crash
or hang, aiding in debugging.
getter/setter pair
- disposition ↔ String
-
Gets or sets the disposition value from the
Content-Dispositionheader field, excluding parameters such asfilename.getter/setter pair - encoding ↔ String
-
Gets or sets the value of the
Content-Transfer-Encodingheader field for the current part. Common values includebase64,quoted-printable,7bit,8bit, andbinary.getter/setter pair - filename ↔ String
-
Gets or sets the
filenameparameter of theContent-Dispositionheader field. The value is a receiver-facing filename, not a local filesystem path.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
Whether dispose has been called on this object.
no setter
- lastErrorHtml → String
-
Provides HTML-formatted information about the last called method or
property. If a method call fails or behaves unexpectedly, check this
property for details. Note that information is available regardless of the
method call's success.
no setter
- lastErrorText → String
-
Provides plain text information about the last called method or property.
If a method call fails or behaves unexpectedly, check this property for
details. Note that information is available regardless of the method
call's success.
no setter
- lastErrorXml → String
-
Provides XML-formatted information about the last called method or
property. If a method call fails or behaves unexpectedly, check this
property for details. Note that information is available regardless of the
method call's success.
no setter
- lastMethodSuccess ↔ bool
-
Indicates the success or failure of the most recent method call:
truemeans success,falsemeans failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.getter/setter pair - micalg ↔ String
-
Gets or sets the
micalgparameter of amultipart/signedContent-Typeheader field.getter/setter pair - name ↔ String
-
Gets or sets the
nameparameter of theContent-Typeheader field. For attachments, filename is generally the primary receiver-facing name.getter/setter pair - numDecryptCerts → int
-
Returns the number of recipient or decryption certificates currently
recorded by the most recent S/MIME encryption, decryption, or
security-unwrapping operation. A new object returns
0. A successful single-recipient encrypt records1, and successful decryption records the certificate whose private key was used.no setter - numHeaderFields → int
-
Returns the number of header-field occurrences in the current part.
Duplicate names count separately and retain their order. Valid indexes
range from
0throughNumHeaderFields - 1for use with getHeaderFieldName and getHeaderFieldValue.no setter - numParts → int
-
Returns the number of direct child parts. It does not include deeper
descendants. Iterate from
0throughNumParts - 1and call partAt to traverse the tree.no setter - numSignerCerts → int
-
Returns the number of signer certificates currently recorded by the most
recent S/MIME signing, signature-verification, or security-unwrapping
operation. A new object returns
0. A single-certificate signing method records1; verify and unwrapSecurity replace the count with the signer results from that operation.no setter - oaepHash ↔ String
-
Gets or sets the hash algorithm used by RSAES-OAEP when encrypting the CMS
content-encryption key. Supported values are
sha1,sha256,sha384, andsha512. The default issha256. An empty or unrecognized value leaves the current valid setting unchanged.getter/setter pair - oaepMgfHash ↔ String
-
Gets or sets the hash algorithm used by the MGF1 mask generation function
within RSAES-OAEP. Supported values are
sha1,sha256,sha384, andsha512. The default issha256. An empty or unrecognized value leaves the current valid setting unchanged.getter/setter pair - oaepPadding ↔ bool
-
Selects the RSA key-transport padding used when creating encrypted MIME.
The default is
false, which uses RSAES-PKCS1-v1_5. Set totrueto use RSAES-OAEP.getter/setter pair - pkcs7CryptAlg ↔ String
-
Gets or sets the symmetric content-encryption algorithm used when creating
CMS/PKCS #7 encrypted MIME. Supported input values are
aes,aes-gcm,des,3des, andrc2. The default isaes. Theaes-gcmoption was added in version 10.0.0.getter/setter pair - pkcs7KeyLength ↔ int
-
Gets or sets the content-encryption key length, in bits, used when
creating CMS/PKCS #7 encrypted MIME. The default is
128.getter/setter pair - protocol ↔ String
-
Gets or sets the
protocolparameter of theContent-Typeheader field. This parameter is commonly used bymultipart/signedto identify the media type of the detached signature part.getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- signingAlg ↔ String
-
Gets or sets the RSA signature scheme used when creating CMS/PKCS #7
signed MIME. The default and normalized PKCS #1 v1.5 value is
PKCS1-V1_5. Set the property toRSASSA-PSSorpssto use RSASSA-PSS; the getter returnsRSASSA-PSS.getter/setter pair - signingHashAlg ↔ String
-
Gets or sets the message-digest algorithm used when creating CMS/PKCS #7
signatures. The default is
sha256. Supported values aresha1,sha256,sha384,sha512,md5, andmd2. Names are case-insensitive and are returned in lowercase.getter/setter pair - uncommonOptions ↔ String
-
Gets or sets a semicolon-delimited or implementation-specific option
string used for uncommon compatibility requirements. The default is the
empty string, and normal applications should leave it empty. Options
placed here may be version-specific and should be used only when directed
by Chilkat documentation or support.
getter/setter pair
- unwrapExtras ↔ bool
-
Controls whether unwrapSecurity adds informative header fields
describing the security layers removed. The default is
true.getter/setter pair - useMmDescription ↔ bool
-
Controls whether Chilkat uses the conventional multipart preamble text
This is a multi-part message in MIME format.when serializing a multipart entity. The default isfalse. The preamble is meaningful only when the multipart has content and is ignored by MIME-aware readers.getter/setter pair - useXPkcs7 ↔ bool
-
Controls whether newly created S/MIME media types use the historical
x-pkcs7names.getter/setter pair - verboseLogging ↔ bool
-
If set to
true, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value isfalse. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.getter/setter pair - version → String
-
Version of the component/library, such as "10.1.0"
no setter
Methods
-
addContentLength(
) → void -
Computes the byte length of the current entity's serialized MIME body and
adds or updates its
Content-Lengthheader. The count is based on the transfer-encoded serialized body, not the decoded payload. -
addDecryptCert(
CkCert cert) → void -
Adds
certto the internal collection of certificates available for S/MIME decryption. The certificate must have access to its corresponding private key. Call this method once for each candidate certificate. -
addDetachedSignature(
CkCert cert) → void -
Creates an S/MIME detached signature using
cert. The certificate itself must have access to its private key. On success, the current object becomes amultipart/signedentity with two direct children: -
addDetachedSignature2(
CkCert cert, bool transferHeaderFields) → void -
Creates the same detached
multipart/signedstructure as addDetachedSignature.certis the signing certificate and must have access to its private key. -
addDetachedSignaturePk(
CkCert cert, CkPrivateKey privateKey) → void -
Creates a detached S/MIME signature using
certas the signer certificate andprivateKeyas its associated private key. Use this method when the certificate and private key are supplied separately. -
addDetachedSignaturePk2(
CkCert cert, CkPrivateKey privateKey, bool transferHeaderFields) → void -
Creates a detached S/MIME signature using the certificate in
certand the corresponding private key inprivateKey.transferHeaderFieldscontrols placement of the existing message header fields: -
addEncryptCert(
CkCert cert) → void -
Adds
certto the internal recipient-certificate list used by encryptN. Call this method once for each intended recipient. Encryption uses the public key in each certificate, so recipient private keys are not required at encryption time. -
addHeaderField(
String name, String value) → void -
Appends a new header field named by
namewith the value invalue. Existing fields having the same case-insensitive name are preserved. An emptyvaluecreates a legal empty-valued field. -
addPfxSourceBd(
CkBinData bd, String password) → void -
Adds the PKCS #12/PFX bytes in
bdto the internal collection of credential sources used by later S/MIME decryption operations.passwordis the password protecting the PFX data. Call the method once for each PFX source that should be searched. -
addPfxSourceFile(
String pfxFilePath, String password) → void -
Adds the PFX/P12 file at the local filesystem path in
pfxFilePathto the internal collection of credential sources used by later S/MIME decryption operations.passwordis the password protecting the file. Call the method once for each PFX source that should be searched. -
appendPart(
CkMime mime) → void -
Appends a copy of
mimeas the last direct child. Chilkat does not retain a reference tomime, so later changes tomimedo not affect the appended part. The same source object may be appended more than once. -
appendPartFromFile(
String filename) → void -
Reads the local file at
filename, creates an attachment part, and appends it. Filename-extension matching is case-insensitive. -
asnBodyToXml(
) → String -
Parses the current part's decoded body as ASN.1 DER and returns an XML
representation of the ASN.1 structure. This is primarily useful for
inspecting CMS/PKCS #7 bodies such as
application/pkcs7-mimeorapplication/x-pkcs7-mime. -
clearEncryptCerts(
) → void - Clears the internal recipient-certificate list populated by addEncryptCert. A subsequent call to encryptN requires certificates to be added again.
-
containsEncryptedParts(
) → bool -
Returns
trueif the currently visible MIME tree contains a CMS/PKCS #7 encrypted entity. Bothapplication/pkcs7-mimeandapplication/x-pkcs7-mimeforms are recognized. -
containsSignedParts(
) → bool -
Returns
trueif the currently visible MIME tree contains a complete detached or opaque CMS/PKCS #7 signed entity. A standaloneapplication/pkcs7-signatureorapplication/x-pkcs7-signatureleaf part is not by itself classified as a signed message. -
convert8Bit(
) → void -
Recursively converts every part whose
Content-Transfer-Encodingis8bitorbinarytobase64. Both the child object'sEncodingproperty and the serialized header are updated. Parts using7bitor another encoding are unchanged. -
convertToMultipartAlt(
) → void -
Wraps the current entity in a new outer
multipart/alternativeentity. The original entity becomes the first and initially only child. -
convertToMultipartMixed(
) → void -
Wraps the current entity in a new outer
multipart/mixedentity. The original entity becomes the first and initially only child. -
convertToSigned(
CkCert cert) → void -
Creates an opaque (attached) S/MIME signature using
cert. The certificate itself must have access to its private key. On success, the current MIME entity is replaced by CMS/PKCS #7signed-datacontaining both the original MIME bytes and the signature. -
convertToSignedPk(
CkCert cert, CkPrivateKey privateKey) → void -
Creates an opaque (attached) S/MIME signature using
certas the signer certificate andprivateKeyas its associated private key. Use this method when the certificate and private key are supplied separately. -
decrypt(
) → void - Decrypts the current CMS/PKCS #7 encrypted MIME entity and replaces it with the recovered MIME content. Chilkat identifies the intended recipient from the CMS recipient information and searches configured credential sources for the matching certificate and private key.
-
decrypt2(
CkCert cert, CkPrivateKey privateKey) → void -
Decrypts the current CMS/PKCS #7 encrypted MIME entity using the
certificate in
certand its associated private key inprivateKey. On success, the encrypted wrapper is replaced by the recovered MIME content, the decryption certificate is available through lastDecryptCert, and operation details are available through getLastJsonData. On failure, the encrypted MIME remains unchanged. -
decryptUsingCert(
CkCert cert) → void -
Decrypts the current CMS/PKCS #7 encrypted MIME entity using
cert. The certificate must have access to its corresponding private key; a public-only certificate is insufficient. On success, the encrypted wrapper is replaced by the recovered MIME content andcertis recorded in the decryption results. On failure, the encrypted MIME remains unchanged. -
decryptUsingPfxFile(
String pfxFilePath, String pfxPassword) → void -
Decrypts the current CMS/PKCS #7 encrypted MIME entity using certificates
and private keys from the PFX/P12 file at the local filesystem path in
pfxFilePath.pfxPasswordis the password protecting the file. -
dispose(
) → void - Releases the native object now instead of waiting for garbage collection.
-
encrypt(
CkCert cert) → void -
Encrypts the current MIME entity for the recipient certificate in
certand replaces it with CMS/PKCS #7 encrypted S/MIME.certmust be RSA-based. Only the recipient's public key is needed to encrypt; the matching private key is required later to decrypt. -
encryptN(
) → void - Encrypts the current MIME entity for every certificate previously added with addEncryptCert. Each recipient receives independently protected access to the same encrypted content.
-
getBodyBd(
CkBinData binDat) → void -
Replaces the contents of
binDatwith the decoded body bytes of the current part. Existing bytes inbinDatare discarded. Base64 and quoted-printable are decoded. MIME headers, multipart boundaries, and child parts are not included. -
getBodyDecoded(
) → String -
Returns the decoded body as text. Chilkat first decodes the
Content-Transfer-Encodingand then interprets text according to the declared charset. -
getBodyEncoded(
) → String - Returns the current part's transfer-encoded body text without decoding Base64 or quoted-printable. The returned value is Chilkat's normalized serialization of the body, not necessarily the exact text that appeared in the loaded MIME. For example, Base64 padding and line wrapping or quoted-printable spelling may be regenerated.
-
getDecryptCertInfo(
CkJsonObject certInfo) → void -
Examines the current encrypted S/MIME entity and writes
recipient-certificate identifiers to the
JsonObjectincertInfo. This can be used to identify which certificate and private key must be made available before calling decrypt or unwrapSecurity. A typical result is: -
getEntireBody(
) → String - Returns the complete serialized body of the current MIME entity. For multipart MIME, this includes boundary delimiters, each child part's headers and body, and the closing boundary. The current entity's own header fields are not included.
-
getEntireHead(
) → String - Returns the complete serialized header section of the current MIME entity. The body and any multipart child content are not included.
-
getHeaderField(
String fieldName) → String -
Returns the value of the first header field whose name matches
fieldNamecase-insensitively. Duplicate later occurrences are not combined. Returns null when no matching field exists. -
getHeaderFieldAttribute(
String name, String attrName) → String -
Returns an attribute value parsed from the first header field named by
name. Both the header name andattrNameattribute name are matched case-insensitively. Surrounding quotation marks are removed, and semicolons inside a quoted value are handled as part of the value. -
getHeaderFieldName(
int index) → String -
Returns the name of the header-field occurrence at zero-based
index. Header order and original casing are preserved for ordinary loaded headers. Use numHeaderFields to determine the valid range. -
getHeaderFieldValue(
int index) → String -
Returns the unfolded value of the header-field occurrence at zero-based
index. Continuation lines are combined into a single value. Use numHeaderFields to determine the valid range. -
getLastJsonData(
CkJsonObject json) → void -
Copies structured details from the most recent operation into
jsonwhen such details are available. Many methods do not produce JSON data. -
getMime(
) → String - Serializes and returns the complete MIME entity, including headers, body, multipart boundaries, and all descendants.
-
getMimeBd(
CkBinData bindat) → void -
Serializes the complete MIME entity and appends its bytes to
bindat. ExistingBinDatabytes are preserved. Use this method when arbitrary binary body bytes must not pass through a text string. -
getMimeSb(
CkStringBuilder sb) → void -
Serializes the complete MIME entity and appends it to
sb. ExistingStringBuildercontent is preserved. -
getSignatureSigningTimeStr(
int index) → String -
Returns the CMS
signingTimesigned attribute for the signer at zero-basedindex, formatted as an RFC 822-style date string in GMT. For example: -
getStructure(
String fmt) → String -
Returns a concise MIME-tree summary.
fmtis case-insensitive. The valuexmlselects XML output; all other values, includingtext, an empty string, or an unrecognized value, select the indented text format. -
getXml(
) → String -
Converts the MIME tree to Chilkat's XML representation and returns it as a
string. Header names become XML element names, structured header
parameters become XML attributes, duplicate headers become repeated
elements, multipart children are nested in
subpartelements, and binary bodies are represented in an encoded textual form. -
hasSignatureSigningTime(
int index) → bool -
Returns
trueif the signer at zero-basedindexhas a CMSsigningTimesigned attribute. Use numSignerCerts for the signer count and getSignatureSigningTimeStr to retrieve the value. -
isApplicationData(
) → bool -
Returns
truewhen contentType begins withapplication/. It returnsfalsefor an empty or malformed media type. -
isAttachment(
) → bool -
Returns
truewhen the current part's disposition value isattachment, matched case-insensitively. Parameters such asfilenamedo not affect the test. Aninlinepart remains non-attachment even when it has a filename. -
isAudio(
) → bool -
Returns
truewhen contentType begins withaudio/. -
isEncrypted(
) → bool -
Returns
truewhen the current MIME entity is a CMS/PKCS #7 encrypted S/MIME wrapper. Bothapplication/pkcs7-mimeandapplication/x-pkcs7-mimeforms are recognized. To search the visible MIME tree rather than only the current entity, use containsEncryptedParts. -
isHtml(
) → bool -
Returns
truewhen contentType istext/html. TheContentTypeproperty must contain only the media type; set parameters such ascharsetseparately. -
isImage(
) → bool -
Returns
truewhen contentType begins withimage/, including values such asimage/svg+xml. -
isMultipart(
) → bool -
Returns
truewhen contentType begins withmultipart/. -
isMultipartAlternative(
) → bool -
Returns
truewhen contentType ismultipart/alternative. -
isMultipartMixed(
) → bool -
Returns
truewhen contentType ismultipart/mixed. -
isMultipartRelated(
) → bool -
Returns
truewhen contentType ismultipart/related. -
isPlainText(
) → bool -
Returns
truewhen contentType istext/plain. -
isSigned(
) → bool -
Returns
truewhen the current MIME entity is a complete CMS/PKCS #7 signed S/MIME wrapper, including detachedmultipart/signedand opaque signed-data forms. A standaloneapplication/pkcs7-signatureorapplication/x-pkcs7-signatureleaf part is not by itself classified as a signed message. To search the visible MIME tree, use containsSignedParts. -
isText(
) → bool -
Returns
truewhen contentType begins withtext/. -
isVideo(
) → bool -
Returns
truewhen contentType begins withvideo/. -
isXml(
) → bool -
Returns
trueonly fortext/xmlorapplication/xml. It does not classify structured-suffix media types such asapplication/soap+xml,application/atom+xml, orimage/svg+xmlas XML. -
lastDecryptCert(
int index, CkCert cert) → void -
Loads into
certthe decryption certificate at zero-basedindexfrom the most recent successful decryption or security-unwrapping operation. Valid indexes range from0through numDecryptCerts- 1. The returned certificate has access to the private key used for decryption. -
lastSignerCert(
int index, CkCert cert) → void -
Loads into
certthe signer certificate at zero-basedindexfrom the most recent successful signature-verification or security-unwrapping operation. Valid indexes range from0through numSignerCerts- 1. The returned certificate normally contains only the public key; it does not gain access to the signer's private key. -
loadMime(
String mimeMsg) → void -
Parses the complete MIME text in
mimeMsgand replaces the current object's headers, body, and multipart tree. A successful call always replaces the previous MIME. -
loadMimeBd(
CkBinData bindat) → void -
Parses complete MIME bytes from
bindatand replaces the current MIME on success. This is the preferred loader when the MIME can contain arbitrary 8-bit body bytes or embedded NUL bytes. Parsing tolerance and serialization normalization are the same as loadMime. -
loadMimeFile(
String fileName) → void -
Reads and parses the complete MIME entity from the local file at
fileName. A successful call replaces the current MIME. If the file cannot be opened, the method returnsfalseand preserves the existing object unchanged. -
loadMimeSb(
CkStringBuilder sb) → void -
Parses complete MIME text from
sband replaces the current MIME on success. Parsing tolerance and serialization normalization are the same as loadMime. -
loadXml(
String xml) → void -
Reconstructs a MIME tree from Chilkat's MIME XML in
xml. On success, the current object is replaced. If the XML is invalid, the method returnsfalseand preserves the existing MIME unchanged. -
loadXmlFile(
String fileName) → void -
Reads Chilkat MIME XML from the local file at
fileNameand reconstructs the MIME tree. On success, the current object is replaced. If the file cannot be opened or the XML is invalid, the method returnsfalseand preserves the existing MIME unchanged. Header names are normalized to lowercase during reconstruction. -
newMessageRfc822(
CkMime mimeObject) → void -
Clears the current object and initializes it as
message/rfc822. Its body is a serialized copy ofmimeObjectat the time of the call. Later modifications tomimeObjectdo not change the embedded message. -
newMultipartAlternative(
) → void -
Initializes an empty
multipart/alternativeentity. Clears all existing headers, body content, and child parts. The new object contains only a multipartContent-Typewith an automatically generated boundary, has zero parts, and does not automatically addMIME-Version. -
newMultipartMixed(
) → void -
Initializes an empty
multipart/mixedentity. Clears all existing headers, body content, and child parts. The new object contains only a multipartContent-Typewith an automatically generated boundary, has zero parts, and does not automatically addMIME-Version. -
newMultipartRelated(
) → void -
Initializes an empty
multipart/relatedentity. Clears all existing headers, body content, and child parts. The new object contains only a multipartContent-Typewith an automatically generated boundary, has zero parts, and does not automatically addMIME-Version. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
partAt(
int index, CkMime subPart) → void -
Provides live access to the direct child at zero-based
indexthroughsubPart. ModifyingsubPartafter a successful call modifies the child stored in the parent MIME tree. -
partsToFiles(
String path, CkStringTable st) → void -
Recursively traverses the MIME tree and saves each part having a nonempty
filenameparameter to the existing directory inpath. Anameparameter alone is not used as a fallback. The disposition may beattachmentorinline; a filename is what controls extraction. -
removeHeaderField(
String fieldName, bool bAllOccurrences) → void -
Removes fields whose name matches
fieldNamecase-insensitively. IfbAllOccurrencesisfalse, only the first matching occurrence is removed. IfbAllOccurrencesistrue, all matching occurrences are removed. Remaining fields retain their relative order. -
removePart(
int index) → void -
Removes the direct child at zero-based
index. Valid indexes range from0through numParts- 1. An out-of-range index returnsfalseand leaves the tree unchanged. -
saveBody(
String filename) → void -
Writes the decoded body bytes of the current part to the local path in
filename. Base64 and quoted-printable are decoded. MIME headers and multipart framing are not written. -
saveMime(
String filename) → void -
Serializes the complete MIME entity and writes it to the local path in
filename, including headers, body, multipart boundaries, and all descendants. -
saveXml(
String filename) → void -
Writes Chilkat's MIME XML representation to the local path in
filename. The file can be loaded by loadXmlFile. -
setBody(
String str) → void -
Sets the current part's body from
strwhile preserving existing content headers such asContent-Type,charset, andContent-Transfer-Encoding. -
setBodyBd(
CkBinData bd) → void -
Sets the decoded body bytes from
bd, changesContent-Transfer-Encodingtobase64, and preserves the bytes exactly. It does not set aContent-Type, disposition, filename, or name; set those separately when needed. -
setBodyFromEncoded(
String encoding, String str) → void -
Sets the body from transfer-encoded text.
encodingmust bebase64orquoted-printable; other values, including7bit,8bit,binary, an unknown name, or an empty string, cause failure. -
setBodyFromFile(
String fileName) → void -
Reads the local file at
fileNameand replaces the current part's body and content headers according to the filename extension. -
setBodyFromHtml(
String str) → void -
Sets
stras HTML and changes the media type totext/html. For ASCII input, Chilkat usesContent-Transfer-Encoding: 7bitand does not add a charset. Existing unrelated headers are preserved. -
setBodyFromPlainText(
String str) → void -
Sets
stras plain text. For ASCII input, Chilkat setsContent-Type: text/plain; format=flowedandContent-Transfer-Encoding: 7bitwithout a charset. For non-ASCII UTF-8 input, it setscharset=utf-8and uses8bit. Existing unrelated headers are preserved. -
setBodyFromXml(
String str) → void -
Sets
stras XML, changes the media type totext/xml, and selects a transfer encoding appropriate for the text. For ASCII input, Chilkat uses7bitand does not add a charset. -
setHeaderField(
String name, String value) → void -
Sets one header field named by
name. Matching is case-insensitive. All existing occurrences are removed and one replacement is inserted. If no field exists, a new one is added. Passing an emptyvalueremoves all matching occurrences rather than creating an empty-valued field. -
setVerifyCert(
CkCert cert) → void -
Supplies
certas a signer-certificate fallback for subsequent signature verification. This is useful when the CMS/PKCS #7 signature does not embed the signer certificate and Chilkat cannot otherwise locate it. Only the public key is required. -
toString(
) → String -
A string representation of this object.
override
-
unwrapSecurity(
) → void - Removes supported S/MIME security layers and restores the underlying MIME content. It handles both common layer orders: a message signed and then encrypted, and a message encrypted and then signed. It continues through nested top-level layers until no additional supported security wrapper remains.
-
urlEncodeBody(
String charset) → void -
Replaces the current body with an
application/x-www-form-urlencoded-style representation using the character set named bycharset. Spaces become+, a literal plus becomes%2B, non-ASCII bytes become%HHsequences, and separators such as&and=remain unchanged. -
useCertVault(
CkXmlCertVault vault) → void -
Sets
vaultas the certificate vault used to locate certificates and private keys for S/MIME encryption, decryption, signing, and verification. Only one vault is active; each call replaces the previously configured vault. -
verify(
) → void -
Verifies the current CMS/PKCS #7 signed MIME entity and removes the
signature wrapper. Both detached
multipart/signedmessages and opaque CMSsigned-dataare supported. The method works with signed MIME loaded from serialized input as well as MIME signed by the current object.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited