ContentType Property  
 

Gets and sets the content type of the selected message part.

Syntax

object.ContentType [= value ]

Remarks

The ContentType property returns the MIME type for the currently selected message part. The type string consists of a primary type and secondary sub-type separated by a slash, followed by one or more optional parameters delimited by semi-colons. For example, this is a common content type for text messages:

text/plain; charset=utf-8

The text designation indicates that this message part contains readable text, and the plain sub-type indicates that the text does not contain any special encoding. The optional parameter which follows the content type provides additional information about the content. In this example, it specifies which character set should be used to display the text. The two common character sets used are UTF-8 and US-ASCII.

There are seven predefined, standard content types, each with their own sub-types. The following table lists these types, along with some common sub-types that are found in messages:

Type Sub-Types Description
text plain, richtext, html Indicates that the message part contains text. This is the most common type found in mail messages; if no content type is explicitly defined, then it is assumed to be plain text
image gif, jpeg Indicates that the message part contains a graphics image
audio basic, aiff, wav Indicates that the message part contains audio data; the basic sub-type is 8-bit PCM encoded audio (commonly found with the .au filename extension)
video mpeg, avi Indicates that the message part contains a video clip in the specified format
application octet-stream, postscript Indicates that the message part contains application specific data, typically used with the octet-stream sub-type to indicate binary file attachments for executable programs, compressed file archives, etc.
message rfc822 Indicates that the message part contains a complete RFC 822 compliant message, complete with headers
multipart mixed, alternative Indicates that this is part of a mixed message (a message that contains multiple parts of different content types)


The three most common content types that are used in applications are text/plain for the mail message body, application/octet-stream for binary file attachments and multipart/mixed for messages that contain both text and attached files. For more information about the different content types, refer to the Multipurpose Internet Mail Extensions (MIME) standards document RFC 1521.

Data Type

String

See Also

ContentID Property, ContentLength Property