Mime Delphi DLL Reference Documentation

Mime

Current Version: 9.5.0.97

Chilkat MIME allows you to easily create and manipulate MIME and S/MIME messages from within your applications.

Create/Dispose

var
myObject: HCkMime;

begin
myObject := CkMime_Create();

// ...

CkMime_Dispose(myObject);
end;
function CkMime_Create: HCkMime; stdcall;

Creates an instance of the HCkMime object and returns a handle (i.e. a Pointer). The handle is passed in the 1st argument for the functions listed on this page.

procedure CkMime_Dispose(handle: HCkMime); stdcall;

Objects created by calling CkMime_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

Properties

Boundary
procedure CkMime_getBoundary(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putBoundary(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__boundary(objHandle: HCkMime): PWideChar; stdcall;

The boundary string for a multipart MIME message.

It is the value of the boundary attribute of the Content-Type header field. For example, if the Content-Type header is this:

Content-Type: multipart/mixed; boundary="------------080707010302060306060800"
then the value of the Boundary property is "------------080707010302060306060800".

When building multipart MIME messages, the boundary is automatically generated by methods such as NewMultipartMixed, to be a unique and random string, so explicitly setting the boundary is usually not necessary.

top
Charset
procedure CkMime_getCharset(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putCharset(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__charset(objHandle: HCkMime): PWideChar; stdcall;

The value of the "charset" attribute of the Content-Type header field. For example, if the Content-Type header is this:

Content-Type: text/plain; charset="iso-8859-1"
then the value of the Charset property is "iso-8859-1".

top
CmsOptions
procedure CkMime_getCmsOptions(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putCmsOptions(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__cmsOptions(objHandle: HCkMime): PWideChar; stdcall;
Introduced in version 9.5.0.78

A JSON string for controlling extra CMS (PKCS7) signature and validation options.

top
ContentType
procedure CkMime_getContentType(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putContentType(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__contentType(objHandle: HCkMime): PWideChar; stdcall;

The MIME content type, such as "text/plain", "text/html", "image/gif", "multipart/alternative", "multipart/mixed", etc.

It is the value of the Content-Type header field, excluding any attributes. For example, if the Content-Type header is this:

Content-Type: multipart/mixed; boundary="------------080707010302060306060800"
then the value of the ContentType property is "multipart/mixed".

top
CurrentDateTime
procedure CkMime_getCurrentDateTime(objHandle: HCkMime; outPropVal: HCkString); stdcall;
function CkMime__currentDateTime(objHandle: HCkMime): PWideChar; stdcall;

Returns the current date/time in RFC 822 format.

More Information and Examples
top
DebugLogFilePath
procedure CkMime_getDebugLogFilePath(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putDebugLogFilePath(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__debugLogFilePath(objHandle: HCkMime): PWideChar; stdcall;

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

top
Disposition
procedure CkMime_getDisposition(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putDisposition(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__disposition(objHandle: HCkMime): PWideChar; stdcall;

The value of the Content-Disposition header field, excluding any attributes. For example, if the Content-Disposition header is this:

Content-Disposition: attachment; filename="starfish.gif"
then the value of the Disposition property is "attachment".

More Information and Examples
top
Encoding
procedure CkMime_getEncoding(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putEncoding(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__encoding(objHandle: HCkMime): PWideChar; stdcall;

The value of the Content-Transfer-Encoding header field. Typical values are "base64", "quoted-printable", "7bit", "8bit", "binary", etc. For example, if the Content-Transfer-Encoding header is this:

Content-Transfer-Encoding: base64
then the value of the Encoding property is "base64".

More Information and Examples
top
Filename
procedure CkMime_getFilename(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putFilename(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__filename(objHandle: HCkMime): PWideChar; stdcall;

The value of the "filename" attribute of the Content-Disposition header field. For example, if the Content-Disposition header is this:

Content-Disposition: attachment; filename="starfish.gif"
then the value of the Filename property is "starfish.gif".

More Information and Examples
top
LastErrorHtml
procedure CkMime_getLastErrorHtml(objHandle: HCkMime; outPropVal: HCkString); stdcall;
function CkMime__lastErrorHtml(objHandle: HCkMime): PWideChar; stdcall;

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorText
procedure CkMime_getLastErrorText(objHandle: HCkMime; outPropVal: HCkString); stdcall;
function CkMime__lastErrorText(objHandle: HCkMime): PWideChar; stdcall;

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorXml
procedure CkMime_getLastErrorXml(objHandle: HCkMime; outPropVal: HCkString); stdcall;
function CkMime__lastErrorXml(objHandle: HCkMime): PWideChar; stdcall;

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastMethodSuccess
function CkMime_getLastMethodSuccess(objHandle: HCkMime): wordbool; stdcall;
procedure CkMime_putLastMethodSuccess(objHandle: HCkMime; newPropVal: wordbool); stdcall;

Indicate whether the last method call succeeded or failed. A value of True indicates success, a value of False indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = True and failure = False.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to True. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

top
Micalg
procedure CkMime_getMicalg(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putMicalg(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__micalg(objHandle: HCkMime): PWideChar; stdcall;

The value of the "micalg" attribute of the Content-Type header field. For example, if the Content-Type header is this:

Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; 
  boundary="------------ms000908010507020408060303"
then the value of the Micalg property is "sha".

Note: The micalg attribute is only present in PKCS7 signed MIME. Setting the Micalg property has the effect of choosing the hash algorithm used w/ signing. Possible choices are "sha1", "md5", "sha256", "sha384", and "sha512". However, it is preferable to set the signing hash algorithm by setting the SigningHashAlg property instead.

top
Name
procedure CkMime_getName(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putName(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__name(objHandle: HCkMime): PWideChar; stdcall;

The value of the "name" attribute of the Content-Type header field. For example, if the Content-Type header is this:

Content-Type: image/gif; name="starfish.gif"
then the value of the Name property is "starfish.gif".

More Information and Examples
top
NumEncryptCerts
function CkMime_getNumEncryptCerts(objHandle: HCkMime): Integer; stdcall;

The number of certificates found when decrypting S/MIME. This property is set after UnwrapSecurity is called.

top
NumHeaderFields
function CkMime_getNumHeaderFields(objHandle: HCkMime): Integer; stdcall;

The number of header fields. Header field names and values can be retrieved by index (starting at 0) by calling GetHeaderFieldName and GetHeaderFieldValue.

top
NumParts
function CkMime_getNumParts(objHandle: HCkMime): Integer; stdcall;

MIME messages are composed of parts in a tree structure. The NumParts property contains the number of direct children. To traverse an entire MIME tree, one would recursively descend the tree structure by iterating from 0 to NumParts-1, calling GetPart to get each direct child MIME object. The traversal would continue by iterating over each child's parts, and so on.

top
NumSignerCerts
function CkMime_getNumSignerCerts(objHandle: HCkMime): Integer; stdcall;

The number of certificates found when verifying signature(s). This property is set after UnwrapSecurity is called.

top
OaepHash
procedure CkMime_getOaepHash(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putOaepHash(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__oaepHash(objHandle: HCkMime): PWideChar; stdcall;
Introduced in version 9.5.0.67

Selects the hash algorithm for use within OAEP padding when encrypting MIME using RSAES-OAEP. The valid choices are "sha1", "sha256", "sha384", "sha512",

top
OaepMgfHash
procedure CkMime_getOaepMgfHash(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putOaepMgfHash(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__oaepMgfHash(objHandle: HCkMime): PWideChar; stdcall;
Introduced in version 9.5.0.71

Selects the MGF hash algorithm for use within OAEP padding when encrypting MIME using RSAES-OAEP. The valid choices are "sha1", "sha256", "sha384", "sha512", The default is "sha1".

top
OaepPadding
function CkMime_getOaepPadding(objHandle: HCkMime): wordbool; stdcall;
procedure CkMime_putOaepPadding(objHandle: HCkMime; newPropVal: wordbool); stdcall;
Introduced in version 9.5.0.67

Selects the RSA encryption scheme when encrypting MIME. The default value is False, which selects RSAES_PKCS1-V1_5. If set to True, then RSAES_OAEP is used.

top
Pkcs7CryptAlg
procedure CkMime_getPkcs7CryptAlg(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putPkcs7CryptAlg(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__pkcs7CryptAlg(objHandle: HCkMime): PWideChar; stdcall;

When the MIME is encrypted (using PKCS7 public-key encryption), this selects the underlying symmetric encryption algorithm. Possible values are: "aes", "des", "3des", and "rc2". The default value is "aes".

top
Pkcs7KeyLength
function CkMime_getPkcs7KeyLength(objHandle: HCkMime): Integer; stdcall;
procedure CkMime_putPkcs7KeyLength(objHandle: HCkMime; newPropVal: Integer); stdcall;

When the MIME is encrypted (using PKCS7 public-key encryption), this selects the key length of the underlying symmetric encryption algorithm. The possible values allowed depend on the Pkcs7CryptAlg property. For "aes", the key length may be 128, 192, or 256. For "3des" the key length must be 192. For "des" the key length must be 40. For "rc2" the key length can be 40, 56, 64, or 128.

top
Protocol
procedure CkMime_getProtocol(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putProtocol(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__protocol(objHandle: HCkMime): PWideChar; stdcall;

The value of the "protocol" attribute of the Content-Type header field. For example, if the Content-Type header is this:

Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; 
  boundary="------------ms000908010507020408060303"
then the value of the Protocol property is "application/x-pkcs7-signature".

top
SigningAlg
procedure CkMime_getSigningAlg(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putSigningAlg(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__signingAlg(objHandle: HCkMime): PWideChar; stdcall;
Introduced in version 9.5.0.67

Selects the signature algorithm to be used when creating signed (PKCS7/CMS) MIME. The default value is "PKCS1-v1_5". This can be set to "RSASSA-PSS" (or simply "pss") to use the RSASSA-PSS signature scheme.

Note: This property only applies when signing with an RSA private key. It does not apply for ECC or DSA private keys.

Also: This property does not get set when a signature is verified. It is only used to specify the algorithm when creating a signature. The LastJsonData method can be used to get information about the verified signature(s).

More Information and Examples
top
SigningHashAlg
procedure CkMime_getSigningHashAlg(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putSigningHashAlg(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__signingHashAlg(objHandle: HCkMime): PWideChar; stdcall;

Selects the underlying hash algorithm used when creating signed (PKCS7) MIME. Possible values are "sha1", "sha256", "sha384", "sha512", "md5", and "md2".

Note: This property does not get set when a signature is verified. It is only used to specify the algorithm when creating a signature. The LastJsonData method can be used to get information about the verified signature(s).

top
UncommonOptions
procedure CkMime_getUncommonOptions(objHandle: HCkMime; outPropVal: HCkString); stdcall;
procedure CkMime_putUncommonOptions(objHandle: HCkMime; newPropVal: PWideChar); stdcall;
function CkMime__uncommonOptions(objHandle: HCkMime): PWideChar; stdcall;
Introduced in version 9.5.0.89

This is a catch-all property to be used for uncommon needs. This property defaults to the empty string and should typically remain empty.

top
UnwrapExtras
function CkMime_getUnwrapExtras(objHandle: HCkMime): wordbool; stdcall;
procedure CkMime_putUnwrapExtras(objHandle: HCkMime; newPropVal: wordbool); stdcall;

Controls whether extra (informative) header fields are added to the MIME message when unwrapping security.

More Information and Examples
top
UseMmDescription
function CkMime_getUseMmDescription(objHandle: HCkMime): wordbool; stdcall;
procedure CkMime_putUseMmDescription(objHandle: HCkMime; newPropVal: wordbool); stdcall;

Controls whether the boilerplate text "This is a multi-part message in MIME format." is used as the body content of a multipart MIME part.

top
UseXPkcs7
function CkMime_getUseXPkcs7(objHandle: HCkMime): wordbool; stdcall;
procedure CkMime_putUseXPkcs7(objHandle: HCkMime; newPropVal: wordbool); stdcall;

If True, then the Content-Type header fields created by Chilkat will use "x-pkcs7" instead of simply "pkcs7" . For example:

Content-Type: multipart/signed;
	boundary="----=_NextPart_af8_0422_dbec3a60.7178e470";
	protocol="application/x-pkcs7-signature"; micalg=sha1

or

Content-Type: application/x-pkcs7-mime; name="smime.p7m"
If False, then the "pcks7" is used. For example:
Content-Type: multipart/signed;
	boundary="----=_NextPart_af8_0422_dbec3a60.7178e470";
	protocol="application/pkcs7-signature"; micalg=sha1

or

Content-Type: application/pkcs7-mime; name="smime.p7m"
The default value of this property is True, meaning that "x-" is used by default.

top
VerboseLogging
function CkMime_getVerboseLogging(objHandle: HCkMime): wordbool; stdcall;
procedure CkMime_putVerboseLogging(objHandle: HCkMime; newPropVal: wordbool); stdcall;

If set to True, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is False. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
procedure CkMime_getVersion(objHandle: HCkMime; outPropVal: HCkString); stdcall;
function CkMime__version(objHandle: HCkMime): PWideChar; stdcall;

Version of the component/library, such as "9.5.0.94"

More Information and Examples
top

Methods

AddContentLength
procedure CkMime_AddContentLength(objHandle: HCkMime) stdcall;

Computes the size of the MIME body and adds a Content-Length header field with the computed value. If the MIME body is non-multipart, the Content-Length is just the size of the content. If the MIME is multipart, then the Content-Length is the sum of all the sub-parts. Calling this method more than once causes the Content-Length header to be re-computed and updated.

More Information and Examples
top
AddDecryptCert
function CkMime_AddDecryptCert(objHandle: HCkMime;
    cert: HCkCert): wordbool; stdcall;
Introduced in version 9.5.0.40

Makes a certificate available for decrypting if needed by methods that decrypt, such as UnwrapSecurity. This method may be called multiple times to make more than one certificate (and it's private key) available. Alternative methods for making certificates available are UseCertVault, AddPfxSourceFile, and AddPfxSourceData.

Returns True for success, False for failure.

top
AddDetachedSignature
function CkMime_AddDetachedSignature(objHandle: HCkMime;
    cert: HCkCert): wordbool; stdcall;

Signs the message using the certificate provided. If successful, the message is converted to "multipart/signed" and the original message will be contained in the first sub-part.

Returns True for success, False for failure.

top
AddDetachedSignature2
function CkMime_AddDetachedSignature2(objHandle: HCkMime;
    cert: HCkCert;
    transferHeaderFields: wordbool): wordbool; stdcall;

Same as AddDetachedSignature, except an extra argument is provided to control whether header fields from the calling MIME object are transferred to the content part of the multipart/signed object. This method transforms the calling object into a multipart/signed MIME with two sub-parts. The first contains the original content of the calling object, and the second contains the digital signature.

Returns True for success, False for failure.

top
AddDetachedSignaturePk
function CkMime_AddDetachedSignaturePk(objHandle: HCkMime;
    cert: HCkCert;
    privateKey: HCkPrivateKey): wordbool; stdcall;

Adds a detached signature using a certificate and it's associated private key. This method would be used when the private key is external to the certificate -- for example, if a PFX/P12 file is not used, but instead a pair of .cer and .pem files are used (one for the certificate and one for the associated private key).

Returns True for success, False for failure.

More Information and Examples
top
AddDetachedSignaturePk2
function CkMime_AddDetachedSignaturePk2(objHandle: HCkMime;
    cert: HCkCert;
    privateKey: HCkPrivateKey;
    transferHeaderFields: wordbool): wordbool; stdcall;

Same as AddDetachedSignaturePk, except an extra argument is provided to control whether header fields from the calling MIME object are transferred to the content part of the multipart/signed object. This method transforms the calling object into a multipart/signed MIME with two sub-parts. The first contains the original content of the calling object, and the second contains the digital signature.

Returns True for success, False for failure.

top
AddEncryptCert
function CkMime_AddEncryptCert(objHandle: HCkMime;
    cert: HCkCert): wordbool; stdcall;

Adds a certificate to the object's internal list of certificates to be used when the EncryptN method is called. (See the EncryptN method for more information.) The internal list may be cleared by calling ClearEncryptCerts.

Returns True for success, False for failure.

top
AddHeaderField
function CkMime_AddHeaderField(objHandle: HCkMime;
    name: PWideChar;
    value: PWideChar): wordbool; stdcall;

Adds a header field to the MIME.

Returns True for success, False for failure.

More Information and Examples
top
AddPfxSourceData
function CkMime_AddPfxSourceData(objHandle: HCkMime;
    pfxFileData: HCkByteData;
    pfxPassword: PWideChar): wordbool; stdcall;

Adds a PFX to the object's internal list of sources to be searched for certificates and private keys when decrypting . Multiple PFX sources can be added by calling this method once for each. (On the Windows operating system, the registry-based certificate stores are also automatically searched, so it is commonly not required to explicitly add PFX sources.)

The pfxFileData contains the bytes of a PFX file (also known as PKCS12 or .p12).

Returns True for success, False for failure.

top
AddPfxSourceFile
function CkMime_AddPfxSourceFile(objHandle: HCkMime;
    pfxFilePath: PWideChar;
    password: PWideChar): wordbool; stdcall;

Adds a PFX file to the object's internal list of sources to be searched for certificates and private keys when decrypting. Multiple PFX files can be added by calling this method once for each. (On the Windows operating system, the registry-based certificate stores are also automatically searched, so it is commonly not required to explicitly add PFX sources.)

The pfxFilePath contains the bytes of a PFX file (also known as PKCS12 or .p12).

Returns True for success, False for failure.

top
AppendPart
function CkMime_AppendPart(objHandle: HCkMime;
    mime: HCkMime): wordbool; stdcall;

Appends a MIME message to the sub-parts of this message. Arbitrarily complex messages with unlimited nesting levels can be created. If the calling Mime object is not already multipart, it is automatically converted to multipart/mixed first.

Returns True for success, False for failure.

More Information and Examples
top
AppendPartFromFile
function CkMime_AppendPartFromFile(objHandle: HCkMime;
    filename: PWideChar): wordbool; stdcall;

Loads a file and creates a Mime message object using the file extension to determine the content type, and adds it as a sub-part to the calling object.

Returns True for success, False for failure.

top
AsnBodyToXml
function CkMime_AsnBodyToXml(objHandle: HCkMime;
    outStr: HCkString): wordbool; stdcall;
function CkMime__asnBodyToXml(objHandle: HCkMime): PWideChar; stdcall;

When the body of a MIME part contains PKCS7 (ASN.1 in DER format, base64-encoded), this method can be used to convert the ASN.1 to an XML format for inspection. Here is an example of how an ASN.1 body might look:

Content-Type: application/x-pkcs7-mime;
	name="smime.p7m"; smime-type="signed-data"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7m"

MIIXXAYJKoZIhvcNAQcCoIIXTTCCF0kCAQExCzAJBgUrDgMCGgUAMFoGCSqGSIb3DQEHAaBNBEtD
b250ZW50LVR5cGU6IHRleHQvcGxhaW4NCkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IDdiaXQN
Cg0KdGhpcyBpcyBhIHRlc3SgghI/MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzEL
...
The XML produced would look something like this:
<?xml version="1.0" encoding="utf-8" ?>
<sequence>
    <oid>1.2.840.113549.1.7.2</oid>
    <contextSpecific tag="0" constructed="1">
        <sequence>
            <int>01</int>
            <set>
                <sequence>
                    <oid>1.3.14.3.2.26</oid>
                    <null />
                </sequence>
            </set>
            <sequence>
                <oid>1.2.840.113549.1.7.1</oid>
                <contextSpecific tag="0" constructed="1">
...

Returns True for success, False for failure.

top
ClearEncryptCerts
procedure CkMime_ClearEncryptCerts(objHandle: HCkMime) stdcall;

Clears the internal list of certificates added by previous calls to the AddEncryptCert method. (See the EncryptN method for information about encrypting using multiple certificates.)

top
ContainsEncryptedParts
function CkMime_ContainsEncryptedParts(objHandle: HCkMime): wordbool; stdcall;

Returns True if the MIME message contains encrypted parts.

Note: This method examines the MIME as-is. If UnwrapSecurity is called and it is successful, then the MIME should no longer contain encrypted parts, and this method would return 0.

Note: If a signed MIME message is then encrypted, then it is not possible to know that the MIME is both encrypted and signed until UnwrapSecurity is called. (In other words, it is not possible to know the contents of the encrypted MIME until it is decrypted.) Therefore, the ContainsSignedParts method would return False.

More Information and Examples
top
ContainsSignedParts
function CkMime_ContainsSignedParts(objHandle: HCkMime): wordbool; stdcall;

Returns True if the MIME message contains signed parts.

Note: This method examines the MIME as-is. If UnwrapSecurity is called and it is successful, then the MIME should no longer contain signed parts, and this method would return 0.

Note: If a signed MIME message is then encrypted, then it is not possible to know that the MIME is both encrypted and signed until UnwrapSecurity is called. (In other words, it is not possible to know the contents of the encrypted MIME until it is decrypted.) Therefore, the ContainsSignedParts method would return False.

Note: The same concept also applies to opaque signatures, such as with the MIME produced by calling ConvertToSigned.

More Information and Examples
top
Convert8Bit
procedure CkMime_Convert8Bit(objHandle: HCkMime) stdcall;

Changes the content-transfer-encoding to "base64" for all 8bit or binary MIME subparts. This allows for the MIME to be exported as a string via the GetMime method.

More Information and Examples
top
ConvertToMultipartAlt
function CkMime_ConvertToMultipartAlt(objHandle: HCkMime): wordbool; stdcall;

Converts existing MIME to a multipart/alternative. This is accomplished by creating a new outermost multipart/alternative MIME part. The existing MIME is moved into the 1st (and only) sub-part of the new multipart/alternative enclosure. Header fields from the original top-level MIME part are transferred to the new top-level multipart/alternative header, except for Content-Type, Content-Transfer-Encoding, and Content-Disposition. For example, the following simple plain-text MIME is converted as follows:

Original:

MIME-Version: 1.0
Date: Sun, 11 Aug 2013 11:18:44 -0500
Message-ID: <D105FA9A2B5F34E253C6E255D58247D26F8BD724@CHILKAT13>
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
X-Priority: 3 (Normal)
Subject: this is the subject.
From: "Chilkat Software" <support@chilkatsoft.com>
To: "Chilkat Sales" <sales@chilkatsoft.com>

This is the plain-text body.

After Converting:

MIME-Version: 1.0
Date: Sun, 11 Aug 2013 11:18:44 -0500
Message-ID: <D105FA9A2B5F34E253C6E255D58247D26F8BD724@CHILKAT13>
X-Priority: 3 (Normal)
Subject: this is the subject.
From: "Chilkat Software" <support@chilkatsoft.com>
To: "Chilkat Sales" <sales@chilkatsoft.com>
Content-Type: multipart/alternative;
	boundary="------------040101040804050401050400_.ALT"

--------------040101040804050401050400_.ALT
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

This is the plain-text body.
--------------040101040804050401050400_.ALT--

Returns True for success, False for failure.

top
ConvertToMultipartMixed
function CkMime_ConvertToMultipartMixed(objHandle: HCkMime): wordbool; stdcall;

Converts existing MIME to a multipart/mixed. This is accomplished by creating a new outermost multipart/mixed MIME part. The existing MIME is moved into the 1st (and only) sub-part of the new multipart/mixed enclosure. Header fields from the original top-level MIME part are transferred to the new top-level multipart/mixed header, except for Content-Type, Content-Transfer-Encoding, and Content-Disposition. For example, the following simple plain-text MIME is converted as follows:

Original:

MIME-Version: 1.0
Date: Sun, 11 Aug 2013 11:27:04 -0500
Message-ID: <B43DAF999B38BFE2C7240D86E691B8628D9D0BF4@CHILKAT13>
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
X-Priority: 3 (Normal)
Subject: this is the subject.
From: "Chilkat Software" <support@chilkatsoft.com>
To: "Chilkat Sales" <sales@chilkatsoft.com>

This is the plain-text body.

After Converting:

MIME-Version: 1.0
Date: Sun, 11 Aug 2013 11:27:04 -0500
Message-ID: <B43DAF999B38BFE2C7240D86E691B8628D9D0BF4@CHILKAT13>
X-Priority: 3 (Normal)
Subject: this is the subject.
From: "Chilkat Software" <support@chilkatsoft.com>
To: "Chilkat Sales" <sales@chilkatsoft.com>
Content-Type: multipart/mixed;
	boundary="------------050508060709030908040207"

--------------050508060709030908040207
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

This is the plain-text body.
--------------050508060709030908040207--

Returns True for success, False for failure.

More Information and Examples
top
ConvertToSigned
function CkMime_ConvertToSigned(objHandle: HCkMime;
    cert: HCkCert): wordbool; stdcall;

Digitally signs a MIME message. The MIME is converted to an application/x-pkcs7-mime which is a PKCS7 signature that includes both the original MIME message and the signature. This is different than AddDetachedSignature, where the signature is appended to the MIME.

Note: This is commonly referred to as an "opaque" signature.

Returns True for success, False for failure.

top
ConvertToSignedPk
function CkMime_ConvertToSignedPk(objHandle: HCkMime;
    cert: HCkCert;
    privateKey: HCkPrivateKey): wordbool; stdcall;

Digitally signs the MIME to convert it to an "opaque" signed message using a certificate and it's associated private key. This method would be used when the private key is external to the certificate -- for example, if a PFX/P12 file is not used, but instead a pair of .cer and .pem files are used (one for the certificate and one for the associated private key).

Returns True for success, False for failure.

More Information and Examples
top
Decrypt
function CkMime_Decrypt(objHandle: HCkMime): wordbool; stdcall;

Decrypts PKCS7 encrypted MIME (also known as S/MIME). Information about the certificates required for decryption is always embedded within PKCS7 encrypted MIME. This method will automatically find and use the certificate + private key required from three possible sources:

  1. PFX files that were provided in one or more calls to AddPfxSourceData or AddPfxSourceFile.
  2. Certificates found in an XML certificate vault provided by calling the UseCertVault method.
  3. (On Windows systems) Certificates found in the system's registry-based certificate stores.

Returns True for success, False for failure.

top
Decrypt2
function CkMime_Decrypt2(objHandle: HCkMime;
    cert: HCkCert;
    privateKey: HCkPrivateKey): wordbool; stdcall;

The same as Decrypt, but useful when the certificate and private key are available in separate files (as opposed to a single file such as a .pfx/.p12).

Returns True for success, False for failure.

top
DecryptUsingCert
function CkMime_DecryptUsingCert(objHandle: HCkMime;
    cert: HCkCert): wordbool; stdcall;
Introduced in version 9.5.0.40

Decrypts PKCS7 encrypted MIME (also known as S/MIME) using a specific certificate.

Returns True for success, False for failure.

top
DecryptUsingPfxData
function CkMime_DecryptUsingPfxData(objHandle: HCkMime;
    pfxData: HCkByteData;
    password: PWideChar): wordbool; stdcall;

Decrypts MIME using a specific PFX ( also known as PKCS12, which is a file format commonly used to store private keys with accompanying public key certificates, protected with a password-based symmetric key). This method allows the bytes of the PKCS12 file to be passed directly, thus allowing PKCS12's to be persisted and retrieved from non-file-based locations, such as in LDAP or a database.

Returns True for success, False for failure.

top
DecryptUsingPfxFile
function CkMime_DecryptUsingPfxFile(objHandle: HCkMime;
    pfxFilePath: PWideChar;
    pfxPassword: PWideChar): wordbool; stdcall;

Decrypts MIME using a specific PFX file (also known as PKCS12) as the source for any required certificates and private keys. (Note: .pfx and .p12 files are both PKCS12 format.)

Returns True for success, False for failure.

More Information and Examples
top
Encrypt
function CkMime_Encrypt(objHandle: HCkMime;
    cert: HCkCert): wordbool; stdcall;

Encrypts the MIME to create PKCS7 encrypted MIME. A digital certificate (which always contains a public-key) is used to encrypt.

Returns True for success, False for failure.

top
EncryptN
function CkMime_EncryptN(objHandle: HCkMime): wordbool; stdcall;

Encrypt MIME using any number of digital certificates. Each certificate to be used must first be added by calling AddEncryptCert (once per certificate). See the example code below:

Returns True for success, False for failure.

top
ExtractPartsToFiles
function CkMime_ExtractPartsToFiles(objHandle: HCkMime;
    dirPath: PWideChar): HCkStringArray; stdcall;

Recursively descends through the parts of a MIME message and extracts all parts having a filename to a file. The files are created in dirPath. Returns a (Ck)StringArray object containing the names of the files created. The filenames are obtained from the "filename" attribute of the content-disposition header. If a filename does not exist, then the MIME part is not saved to a file.

Returns nil on failure

More Information and Examples
top
FindIssuer
function CkMime_FindIssuer(objHandle: HCkMime;
    cert: HCkCert): HCkCert; stdcall;

Finds and returns the issuer certificate. If the certificate is a root or self-issued, then the certificate returned is a copy of the caller certificate.

Returns nil on failure

top
GetBodyBd
function CkMime_GetBodyBd(objHandle: HCkMime;
    binDat: HCkBinData): wordbool; stdcall;
Introduced in version 9.5.0.67

Returns the body of the MIME message in a BinData object.

Returns True for success, False for failure.

top
GetBodyBinary
function CkMime_GetBodyBinary(objHandle: HCkMime;
    outData: HCkByteData): wordbool; stdcall;

Returns the body of the MIME message as a block of binary data. The body is automatically converted from its encoding type, such as base64 or quoted-printable, before being returned.

Returns True for success, False for failure.

top
GetBodyDecoded
function CkMime_GetBodyDecoded(objHandle: HCkMime;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getBodyDecoded(objHandle: HCkMime): PWideChar; stdcall;

Returns the body of the MIME message as a string. The body is automatically converted from its encoding type, such as base64 or quoted-printable, before being returned.

Returns True for success, False for failure.

top
GetBodyEncoded
function CkMime_GetBodyEncoded(objHandle: HCkMime;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getBodyEncoded(objHandle: HCkMime): PWideChar; stdcall;

Returns the body of the MIME message as a String. The body is explicitly not decoded from it's encoding type, so if it was represented in Base64, you will get the Base64 encoded body, as an example.

Returns True for success, False for failure.

top
GetEncryptCert
function CkMime_GetEncryptCert(objHandle: HCkMime;
    index: Integer): HCkCert; stdcall;

Returns the Nth certificate found when decrypting. The EncryptCerts property contains the number of certificates.

Returns nil on failure

More Information and Examples
top
GetEntireBody
function CkMime_GetEntireBody(objHandle: HCkMime;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getEntireBody(objHandle: HCkMime): PWideChar; stdcall;

Returns the entire MIME body, including all sub-parts.

Returns True for success, False for failure.

More Information and Examples
top
GetEntireHead
function CkMime_GetEntireHead(objHandle: HCkMime;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getEntireHead(objHandle: HCkMime): PWideChar; stdcall;

Returns the MIME header.

Returns True for success, False for failure.

More Information and Examples
top
GetHeaderField
function CkMime_GetHeaderField(objHandle: HCkMime;
    fieldName: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getHeaderField(objHandle: HCkMime;
    fieldName: PWideChar): PWideChar; stdcall;

Returns the value of a MIME header field. fieldName is case-insensitive.

Returns True for success, False for failure.

More Information and Examples
top
GetHeaderFieldAttribute
function CkMime_GetHeaderFieldAttribute(objHandle: HCkMime;
    name: PWideChar;
    attrName: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getHeaderFieldAttribute(objHandle: HCkMime;
    name: PWideChar;
    attrName: PWideChar): PWideChar; stdcall;

Parses a MIME header field and returns the value of an attribute. MIME header fields w/ attributes are formatted like this:

Header-Name:  value;  attrName1="value1"; attrName2="value2"; ....  attrNameN="valueN"
Semi-colons separate attribute name=value pairs. The Content-Type header field often contains attributes. Here is an example:
Content-Type: multipart/signed;
	protocol="application/x-pkcs7-signature";
	micalg=SHA1;
	boundary="----=_NextPart_000_0000_01CB03E4.D0BAF010"
In the above example, to access the value of the "protocol" attribute, call GetHeaderFieldAttribute("Content-Type", "protocol");

Returns True for success, False for failure.

More Information and Examples
top
GetHeaderFieldName
function CkMime_GetHeaderFieldName(objHandle: HCkMime;
    index: Integer;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getHeaderFieldName(objHandle: HCkMime;
    index: Integer): PWideChar; stdcall;

Returns the Nth MIME header field name.

Returns True for success, False for failure.

top
GetHeaderFieldValue
function CkMime_GetHeaderFieldValue(objHandle: HCkMime;
    index: Integer;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getHeaderFieldValue(objHandle: HCkMime;
    index: Integer): PWideChar; stdcall;

Returns the Nth MIME header field value.

Returns True for success, False for failure.

top
GetMime
function CkMime_GetMime(objHandle: HCkMime;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getMime(objHandle: HCkMime): PWideChar; stdcall;

Returns a string containing the complete MIME message, including all sub-parts.

Returns True for success, False for failure.

top
GetMimeBd
function CkMime_GetMimeBd(objHandle: HCkMime;
    bindat: HCkBinData): wordbool; stdcall;
Introduced in version 9.5.0.62

Appends the MIME to a BinData object.

Returns True for success, False for failure.

More Information and Examples
top
GetMimeBytes
function CkMime_GetMimeBytes(objHandle: HCkMime;
    outBytes: HCkByteData): wordbool; stdcall;

Returns a byte array containing the complete MIME message, including all sub-parts.

Returns True for success, False for failure.

top
GetMimeSb
function CkMime_GetMimeSb(objHandle: HCkMime;
    sb: HCkStringBuilder): wordbool; stdcall;
Introduced in version 9.5.0.62

Appends the MIME to a StringBuilder object.

Returns True for success, False for failure.

More Information and Examples
top
GetPart
function CkMime_GetPart(objHandle: HCkMime;
    index: Integer): HCkMime; stdcall;

Returns the Nth sub-part of the MIME message. Indexing begins at 0.

Returns nil on failure

top
GetSignatureSigningTimeStr
function CkMime_GetSignatureSigningTimeStr(objHandle: HCkMime;
    index: Integer;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getSignatureSigningTimeStr(objHandle: HCkMime;
    index: Integer): PWideChar; stdcall;

The same as the GetSignatureSigningTime method, but returns tjhe date/time in RFC822 string format.

Returns True for success, False for failure.

top
GetSignerCert
function CkMime_GetSignerCert(objHandle: HCkMime;
    index: Integer): HCkCert; stdcall;

Returns the Nth digital certificate used to sign the MIME message. Indexing begins at 0.

Returns nil on failure

More Information and Examples
top
GetSignerCertChain
function CkMime_GetSignerCertChain(objHandle: HCkMime;
    index: Integer): HCkCertChain; stdcall;
Introduced in version 9.5.0.40

Returns the full certificate chain for the Nth certificate used to sign the MIME message. Indexing begins at 0.

Returns nil on failure

top
GetStructure
function CkMime_GetStructure(objHandle: HCkMime;
    fmt: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getStructure(objHandle: HCkMime;
    fmt: PWideChar): PWideChar; stdcall;
Introduced in version 9.5.0.56

Returns a string summarizing the MIME structure. The output format is specified by fmt and can be "text" or "xml".

Returns True for success, False for failure.

More Information and Examples
top
GetXml
function CkMime_GetXml(objHandle: HCkMime;
    outStr: HCkString): wordbool; stdcall;
function CkMime__getXml(objHandle: HCkMime): PWideChar; stdcall;

Converts the MIME (or S/MIME) message to XML and returns the XML as a string.

Returns True for success, False for failure.

More Information and Examples
top
HasSignatureSigningTime
function CkMime_HasSignatureSigningTime(objHandle: HCkMime;
    index: Integer): wordbool; stdcall;

Returns True if the Nth signature included a timestamp that recorded the signing time. The number of signatures (i.e. signer certs) is indicated by the NumSignerCerts property. (In most cases, the number of signer certs is 1.) The signing time can be obtained via the GetSignatureSigningTime or GetSignatureSigningTimeStr methods. The index of the 1st signature signing time is 0.

top
IsApplicationData
function CkMime_IsApplicationData(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message contains application data, otherwise returns False.

top
IsAttachment
function CkMime_IsAttachment(objHandle: HCkMime): wordbool; stdcall;

Return True if this MIME message is an attachment, otherwise returns False. A MIME message is considered an attachment if the Content-Disposition header field contains the value "attachment".

top
IsAudio
function CkMime_IsAudio(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message contains audio data, otherwise returns False.

top
IsEncrypted
function CkMime_IsEncrypted(objHandle: HCkMime): wordbool; stdcall;

Returns True if the MIME message is PKCS7 encrypted, otherwise returns False.

top
IsHtml
function CkMime_IsHtml(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME body is HTML, otherwise returns False.

top
IsImage
function CkMime_IsImage(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message contains image data, otherwise returns False.

top
IsMultipart
function CkMime_IsMultipart(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message is multipart (multipart/mixed, multipart/related, multipart/alternative, etc.), otherwise returns False.

top
IsMultipartAlternative
function CkMime_IsMultipartAlternative(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message is multipart/alternative, otherwise returns False.

top
IsMultipartMixed
function CkMime_IsMultipartMixed(objHandle: HCkMime): wordbool; stdcall;

Return true if the MIME message is multipart/mixed, otherwise returns False.

top
IsMultipartRelated
function CkMime_IsMultipartRelated(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message is multipart/related, otherwise returns False.

top
IsPlainText
function CkMime_IsPlainText(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message body is plain text, otherwise returns False.

top
IsSigned
function CkMime_IsSigned(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message is PKCS7 digitally signed, otherwise returns False.

top
IsText
function CkMime_IsText(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message body is any text content type, such as text/plain, text/html, text/xml, etc., otherwise returns False.

top
IsVideo
function CkMime_IsVideo(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message contains video data, otherwise returns False.

top
IsXml
function CkMime_IsXml(objHandle: HCkMime): wordbool; stdcall;

Return True if the MIME message body is XML, otherwise returns False.

top
LastJsonData
function CkMime_LastJsonData(objHandle: HCkMime): HCkJsonObject; stdcall;
Introduced in version 9.5.0.69

Provides information about what transpired in the last method called on this object instance. For many methods, there is no information. However, for some methods, details about what occurred can be obtained by getting the LastJsonData right after the method call returns. For example, after calling UnwrapSecurity, the LastJsonData will return JSON with details about the algorithms used for signature verification and decryption.

Returns nil on failure

top
LoadMime
function CkMime_LoadMime(objHandle: HCkMime;
    mimeMsg: PWideChar): wordbool; stdcall;

Discards the current contents of the MIME object and loads a new MIME message from a string.

Returns True for success, False for failure.

top
LoadMimeBd
function CkMime_LoadMimeBd(objHandle: HCkMime;
    bindat: HCkBinData): wordbool; stdcall;
Introduced in version 9.5.0.62

Discards the current contents of the MIME object and loads a new MIME message from a BinData object.

Returns True for success, False for failure.

top
LoadMimeBytes
function CkMime_LoadMimeBytes(objHandle: HCkMime;
    binData: HCkByteData): wordbool; stdcall;

Loads a MIME document from an in-memory byte array.

Returns True for success, False for failure.

top
LoadMimeFile
function CkMime_LoadMimeFile(objHandle: HCkMime;
    fileName: PWideChar): wordbool; stdcall;

Discards the current contents of the MIME object and loads a new MIME message from a file.

Returns True for success, False for failure.

top
LoadMimeSb
function CkMime_LoadMimeSb(objHandle: HCkMime;
    sb: HCkStringBuilder): wordbool; stdcall;
Introduced in version 9.5.0.62

Discards the current contents of the MIME object and loads a new MIME message from a StringBuilder.

Returns True for success, False for failure.

More Information and Examples
top
LoadXml
function CkMime_LoadXml(objHandle: HCkMime;
    xml: PWideChar): wordbool; stdcall;

Converts XML to MIME and replaces the MIME object's contents with the converted XML.

Returns True for success, False for failure.

top
LoadXmlFile
function CkMime_LoadXmlFile(objHandle: HCkMime;
    fileName: PWideChar): wordbool; stdcall;

Converts XML to MIME and replaces the MIME object's contents with the converted XML.

Returns True for success, False for failure.

top
NewMessageRfc822
function CkMime_NewMessageRfc822(objHandle: HCkMime;
    mimeObject: HCkMime): wordbool; stdcall;

Clears the Mime object and initializes it such that the header contains a "content-type: message/rfc822" line and the body is the MIME text of the Mime object passed to the method.

Returns True for success, False for failure.

top
NewMultipartAlternative
function CkMime_NewMultipartAlternative(objHandle: HCkMime): wordbool; stdcall;

Discards the current MIME message header fields and contents, if any, an initializes the MIME object to be an empty mulipart/alternative message.

Returns True for success, False for failure.

More Information and Examples
top
NewMultipartMixed
function CkMime_NewMultipartMixed(objHandle: HCkMime): wordbool; stdcall;

Discards the current MIME message header fields and contents, if any, an initializes the MIME object to be an empty mulipart/mixed message.

Returns True for success, False for failure.

top
NewMultipartRelated
function CkMime_NewMultipartRelated(objHandle: HCkMime): wordbool; stdcall;

Discards the current MIME message header fields and contents, if any, an initializes the MIME object to be an empty mulipart/related message.

Returns True for success, False for failure.

More Information and Examples
top
RemoveHeaderField
procedure CkMime_RemoveHeaderField(objHandle: HCkMime;
    fieldName: PWideChar;
    bAllOccurrences: wordbool) stdcall;

Removes a header field from the MIME header. If bAllOccurrences is True, then all occurrences of the header field are removed. Otherwise, only the 1st occurrence is removed.

More Information and Examples
top
RemovePart
function CkMime_RemovePart(objHandle: HCkMime;
    index: Integer): wordbool; stdcall;

Removes the Nth subpart from the MIME message.

Returns True for success, False for failure.

top
SaveBody
function CkMime_SaveBody(objHandle: HCkMime;
    filename: PWideChar): wordbool; stdcall;

Saves the MIME message body to a file. If the body is base64 or quoted-printable encoded, it is automatically decoded.

Returns True for success, False for failure.

top
SaveMime
function CkMime_SaveMime(objHandle: HCkMime;
    filename: PWideChar): wordbool; stdcall;

Saves the MIME message to a file, in MIME format. (This is the same as the .EML format used by Microsoft Outlook Express.)

Returns True for success, False for failure.

top
SaveXml
function CkMime_SaveXml(objHandle: HCkMime;
    filename: PWideChar): wordbool; stdcall;

Converts the MIME message to XML and saves to an XML file.

Returns True for success, False for failure.

top
SetBody
procedure CkMime_SetBody(objHandle: HCkMime;
    str: PWideChar) stdcall;

Sets the MIME body content to a text string.

More Information and Examples
top
SetBodyFromBinary
function CkMime_SetBodyFromBinary(objHandle: HCkMime;
    binData: HCkByteData): wordbool; stdcall;

Sets the MIME message body from a byte array.

Returns True for success, False for failure.

More Information and Examples
top
SetBodyFromEncoded
function CkMime_SetBodyFromEncoded(objHandle: HCkMime;
    encoding: PWideChar;
    str: PWideChar): wordbool; stdcall;

Sets the MIME message body from a Base64 or Quoted-Printable encoded string.

Returns True for success, False for failure.

More Information and Examples
top
SetBodyFromFile
function CkMime_SetBodyFromFile(objHandle: HCkMime;
    fileName: PWideChar): wordbool; stdcall;

Sets the MIME message body from the contents of a file. Note: A MIME message consists of a header and a body. The body may itself be a MIME message that consists of a header and body, etc. This method loads the contents of a file into the body of a MIME message, without replacing the header.

The Content-Type and Content-Transfer-Encoding header fields are automatically updated to match the type of content loaded (based on file extension). If your application requires the MIME to have a specific Content-Type and/or Content-Transfer-Encoding, set the ContentType and Encoding properties after calling this method (not before).

Returns True for success, False for failure.

More Information and Examples
top
SetBodyFromHtml
function CkMime_SetBodyFromHtml(objHandle: HCkMime;
    str: PWideChar): wordbool; stdcall;

Sets the MIME message body from a string containing HTML. The Content-Type header is added or updated to the value "text/html".

If 8bit (non-us-ascii) characters are present, and if the Charset property was not previously set, then the "charset" attribute is automatically added to the Content-Type header using the default value of "utf-8". This can be changed at any time by setting the Charset property.

If the Encoding property was not previously set, then the Content-Transfer-Encoding header is automatically added. It will be set to "7bit" or "8bit" depending on whether the HTML body contains 8-bit non-us-ascii characters.

To set the MIME body with no intentional side-effects, use SetBody instead.

Returns True for success, False for failure.

top
SetBodyFromPlainText
function CkMime_SetBodyFromPlainText(objHandle: HCkMime;
    str: PWideChar): wordbool; stdcall;

Sets the MIME message body from a string containing plain-text. The Content-Type header is added or updated to the value "text/plain".

If 8bit (non-us-ascii) characters are present, and if the Charset property was not previously set, then the "charset" attribute is automatically added to the Content-Type header using the default value of "utf-8". This can be changed at any time by setting the Charset property.

If the Encoding property was not previously set, then the Content-Transfer-Encoding header is automatically added. It will be set to "7bit" or "8bit" depending on whether the plain-text body contains 8-bit non-us-ascii characters.

To set the MIME body with no intentional side-effects, use SetBody instead.

Returns True for success, False for failure.

top
SetBodyFromXml
function CkMime_SetBodyFromXml(objHandle: HCkMime;
    str: PWideChar): wordbool; stdcall;

Sets the MIME message body from a string containing XML. The Content-Type header is added or updated to the value "text/xml".

If 8bit (non-us-ascii) characters are present, and if the Charset property was not previously set, then the "charset" attribute is automatically added to the Content-Type header using the default value of "utf-8". This can be changed at any time by setting the Charset property.

If the Encoding property was not previously set, then the Content-Transfer-Encoding header is automatically added. It will be set to "7bit" or "8bit" depending on whether the plain-text body contains 8-bit non-us-ascii characters.

To set the MIME body with no intentional side-effects, use SetBody instead.

Returns True for success, False for failure.

More Information and Examples
top
SetHeaderField
function CkMime_SetHeaderField(objHandle: HCkMime;
    name: PWideChar;
    value: PWideChar): wordbool; stdcall;

Adds or replaces a MIME message header field. If the field already exists, it is automatically replaced. Otherwise it is added. Pass zero-length value to remove the header field.

Returns True for success, False for failure.

More Information and Examples
top
SetVerifyCert
function CkMime_SetVerifyCert(objHandle: HCkMime;
    cert: HCkCert): wordbool; stdcall;

Allows a certificate to be explicitly specified for verifying a signature.

Returns True for success, False for failure.

top
UnwrapSecurity
function CkMime_UnwrapSecurity(objHandle: HCkMime): wordbool; stdcall;

Decrypts and/or verifies all digital signatures contained within the MIME message, and returns True if all decryptions and verifications succeeded. Otherwise returns False. After unwrapping, the information regarding security and certificates can be obtained by the methods GetSignerCert and GetEncryptCert, and the properties NumEncryptCerts and NumSignerCerts.

The MIME is restored to the original structure/content prior to all signing and/or encryption.

The difference between UnwrapSecurity and methods such as Verify or Decrypt is that UnwrapSecurity will recursively traverse the MIME to decrypt and/or verify all parts. Also, UnwrapSecurity will unwrap layers until no further encrypted/signed content is found. For example, if a MIME message was encrypted and then subsequently signed, then UnwrapSecurity will verify and unwrap the detached signature/signed-data layer, and then decrypt the "enveloped data".

Returns True for success, False for failure.

More Information and Examples
top
UrlEncodeBody
procedure CkMime_UrlEncodeBody(objHandle: HCkMime;
    charset: PWideChar) stdcall;

URL encodes the MIME body. The charset is important. For example, consider this MIME:

Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Société
If the charset is set to "utf-8", then the following is produced:
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Soci%C3%A9t%C3%A9
However, if the charset is set to "ansi", then the following is the result:
Content-Type: text/plain
Content-Transfer-Encoding: 8bit

Soci%E9t%E9

top
UseCertVault
function CkMime_UseCertVault(objHandle: HCkMime;
    vault: HCkXmlCertVault): wordbool; stdcall;

Adds an XML certificate vault to the object's internal list of sources to be searched for certificates and private keys when encrypting/decrypting or signing/verifying. Unlike the AddPfxSourceData and AddPfxSourceFile methods, only a single XML certificate vault can be used. If UseCertVault is called multiple times, only the last certificate vault will be used, as each call to UseCertVault will replace the certificate vault provided in previous calls.

Returns True for success, False for failure.

top
Verify
function CkMime_Verify(objHandle: HCkMime): wordbool; stdcall;

Verifies PKCS7 signed MIME and "unwraps" the signature. The MIME is restored to the original structure that it would have originally had prior to signing. The Verify method works with both detached signatures, as well as opaque/attached signatures.

A PKCS7 signature usually embeds both the signing certificate with its public key. Therefore, it is usually possible to verify a signature without the need to already have the certificate installed. If the signature does not embed the certificate, the Verify method will automatically locate and use the certificate if it was correctly pre-installed on the computer.

Returns True for success, False for failure.

top