CreatePart Method  
 

Create a new message part in a multipart message.

Syntax

object.CreatePart( [MessageText], [CharacterSet], [EncodingType] )

Parameters

MessageText
An optional string argument which specifies the body of the new message part. Each line of text contained in the string should be terminated with a carriage-return/linefeed (CRLF) pair, which is recognized as the end-of-line. If the argument is not specified, then the message part will have an empty body.
CharacterSet
An optional integer value which specifies the character set for the message part. If this parameter is omitted, the default is for the message to be composed using the standard UTF-8 character set.
EncodingType
An optional integer value which specifies the content encoding to use for the message part. The default is for the control to use 7-bit encoding. If an 8-bit character set is specified for the CharacterSet argument, the default encoding type will be set to quoted-printable. One of the following values may be used:
Value Constant Description
1 mimeEncoding7Bit Each character is encoded in one or more bytes, with each byte being 8 bits long, with the first bit cleared. This encoding is most commonly used with plain text using the US-ASCII character set, where each character is represented by a single byte in the range of 20h to 7Eh.
2 mimeEncoding8Bit Each character is encoded in one or more bytes, with each byte being 8 bits long and all bits are used. 8-bit encoding may be used with UTF-8 and other multi-byte character sets.
4 mimeEncodingQuoted Quoted-printable encoding is designed for textual messages where most of the characters are represented by the ASCII character set and is generally human-readable. Non-printable characters or 8-bit characters with the high bit set are encoded as hexadecimal values and represented as 7-bit text. Quoted-printable encoding is typically used for messages which use character sets such as ISO-8859-1, as well as those which use HTML.
5 mimeEncodingBase64 Base64 encoding converts binary or text data to ASCII by translating it so each base64 digit represents 6 bits of data. This encoding method is commonly used with messages that contain binary data (such as binary file attachments), or when text uses extended characters that cannot be represented by 7-bit ASCII. It is recommended that you use base64 encoding with Unicode text.

Return Value

A value of zero is returned if the method succeeds. Otherwise, a non-zero error code is returned which indicates the cause of the failure.

Remarks

The CreatePart method creates a new message part. If the current message is a simple RFC822 formatted message, then this method converts it to a MIME multipart message. The current message part will be set to the new part that was just created.

See Also

Bcc Property, Cc Property, Encoding Property, From Property, Subject Property, Text Property, To Property