Working with a MIME entity in LotusScript® classes

The NotesMIMEEntity class is used to access items of type MIME (Multipurpose Internet Mail Extensions). MIME defines techniques for handling 8-bit data, character sets, and a variety of content types. MIME also allows for structured messages, where a message can have multiple parts and relations between the parts.

A typical example is an Internet mail message routed to a mail file without conversion to rich text.

The MIME parts of a document are items of type MIME_PART. In Internet mail messages they are typically named "Body." Programmatically you can access these items as NotesItem, NotesRichTextItem, or NotesMIMEEntity objects.

To access the MIME content of a NotesDocument:

  • First set NotesSession.ConvertMIME to False to override normal conversion of MIME items to rich text.
  • Then call NotesDocument.GetMIMEEntity.
  • Or call NotesDocument.GetFirstItem followed by NotesItem.GetMIMEEntity.
  • To create an item in MIME format, call NotesDocument.CreateMIMEEntity.
  • To close MIME processing so you can work on items directly, call NotesDocument.CloseMIMEEntities.
  • Before exiting your code, set NotesSession.ConvertMIME back to True (or the original setting).

The following table lists the properties of NotesMIMEEntity.

Property

Data type

Description

BoundaryEnd

String

(Read-only) The boundary that follows a child entity in a multipart entity.

BoundaryStart

String

(Read-only) The boundary that precedes a child entity in a multipart entity.

CharSet

String

(Read-only) Content character set of a MIME entity.

ContextAsText

String

(Read-only) The content of a MIME entity in text format.

ContentSubType

String

(Read-only) The sub-type of the content type of a MIME entity.

ContentType

String

(Read-only) The content type of a MIME entity.

Encoding

Constant of type Integer

(Read-only) Current® encoding for the non-header content of a MIME entity.

HeaderObjects

Array of type NotesMIMEHeader

(Read-only) All headers for a MIME entity.

Headers

String

(Read-only) All headers for a MIME entity as one string; GetSomeHeadersproperty returns specified headers.

Preamble

String

Preamble of a MIME multipart entity.

The following methods access the content of a MIME entity:

  • DecodeContent
  • EncodeContent
  • GetContentAsBytes
  • GetContentAsText
  • GetEntityAsText
  • SetContentFromBytes
  • SetContentFromText

The following methods manipulate multipart MIME entities:

  • CreateChildEntity
  • CreateParentEntity
  • GetFirstChildEntity
  • GetNextEntity
  • GetNextSibling
  • GetParentEntity
  • GetPrevEntity
  • GetPrevSibling

The Remove method removes an entity.

The CreateHeader and GetNthHeader methods access MIME headers as NotesMIMEHeader objects (as well as the HeaderObjects property).

The NotesMIMEHeader class has a HeaderName property, a Remove method, and the following methods for accessing header content:

  • AddValText
  • GetHeaderVal
  • GetHeaderValAndParams
  • GetParamVal
  • SetHeaderVa
  • SetHeaderValAndParams
  • SetParamVal