Skip to main content


class %Net.MIMEPart extends %Library.RegisteredObject

For information on using this class, see MIME Messages.

%Net.MIMEPart holds a MIME message part.

Property Inventory

Method Inventory


property Body as %RegisteredObject;
The body of the attachment as a stream. Either Parts must contain MIMEParts or Body must be specified, but not both.
Property methods: BodyGet(), BodyGetSwizzled(), BodyIsValid(), BodyNewObject()
property Boundary as %String);
Boundary to used to separate parts of the message. If none is specified, a default is created.
Property methods: BoundaryDisplayToLogical(), BoundaryIsValid(), BoundaryLogicalToDisplay(), BoundaryLogicalToOdbc(), BoundaryNormalize(), BoundarySet()
property ContentCharset as %String) [ Calculated ];
If the ContentType starts with 'text/' then this is the charset to encode the contents with. This is actually specified in the MIME Content-Type header with something like:

Content-Type: text/html; charset=UTF-8

You must set this property after you set the ContentType or it will overwrite this value.

Property methods: ContentCharsetDisplayToLogical(), ContentCharsetIsValid(), ContentCharsetLogicalToDisplay(), ContentCharsetLogicalToOdbc(), ContentCharsetNormalize()
property ContentId as %String);
The normalized content-id. Any leading or trailing whitespace and enclosing <> are removed.
Property methods: ContentIdDisplayToLogical(), ContentIdGet(), ContentIdIsValid(), ContentIdLogicalToDisplay(), ContentIdLogicalToOdbc(), ContentIdNormalize()
property ContentLocation as %String);
The normalized content-location. Any leading or trailing whitespace and comments are removed.
Property methods: ContentLocationDisplayToLogical(), ContentLocationGet(), ContentLocationIsValid(), ContentLocationLogicalToDisplay(), ContentLocationLogicalToOdbc(), ContentLocationNormalize()
property ContentTransferEncoding as %String (VALUELIST = ",base64,quoted-printable,7bit,8bit,binary");
Content-Transfer-Encoding header. Can be one of "base64", "quoted-printable", "7bit", "8bit", "binary".
Property methods: ContentTransferEncodingDisplayToLogical(), ContentTransferEncodingIsValid(), ContentTransferEncodingLogicalToDisplay(), ContentTransferEncodingLogicalToOdbc(), ContentTransferEncodingNormalize()
property ContentType as %String) [ Calculated ];
Sets/gets the 'Content-Type:' MIME header. A Content-Type specifies the media type of the Body data. A Content-Transfer-Encoding header may be used to indicate any additional content coding applied to the type.
Property methods: ContentTypeDisplayToLogical(), ContentTypeIsValid(), ContentTypeLogicalToDisplay(), ContentTypeLogicalToOdbc(), ContentTypeNormalize()
property PartOwnedStream as %Boolean;
If PartOwnedStream is true, then the part owns the stream and should cleasr it when the part is deleted.
Property methods: PartOwnedStreamDisplayToLogical(), PartOwnedStreamGet(), PartOwnedStreamIsValid(), PartOwnedStreamLogicalToDisplay(), PartOwnedStreamNormalize(), PartOwnedStreamSet()
property Parts as list of %Net.MIMEPart;
Parts of a multipart message. Either Parts must contain MIMEParts or Body must be specified, but not both.
Property methods: PartsBuildValueArray(), PartsCollectionToDisplay(), PartsCollectionToOdbc(), PartsDisplayToCollection(), PartsGet(), PartsGetObject(), PartsGetObjectId(), PartsGetSwizzled(), PartsIsValid(), PartsOdbcToCollection(), PartsSet(), PartsSetObject(), PartsSetObjectId()


method %OnNew(body As %CSP.BinaryStream = "") as %Status
Optionally initialize the body (and possibly the headers) during construction.
method BodySet(body As %CSP.BinaryStream = "") as %Status
Set the body of the attachment to a stream. If the stream contains a Headers attribute, this attribute is used to initialize the headers of the MIME part. The %CSP.BinaryStream that is returned by the CSP engine is an example of such a stream with Headers attribute.
method BoundaryGet() as %String
method ClearHeaders() as %Status
Clear the list of headers
method ContentCharsetGet() as %String
method ContentCharsetSet(charset As %String) as %Status
method ContentIdSet(value As %String) as %Status
method ContentLocationSet(value As %String) as %Status
method ContentTransferEncodingGet() as %String
method ContentTransferEncodingSet(value As %String) as %Status
method ContentTypeGet() as %String
method ContentTypeSet(contenttype As %String) as %Status
method GetContentTypeAttribute(name As %String)
Return an attribute of a previously stored Content-Type.
method GetHeader(name As %String, Output originalName As %String) as %String
Lookup a previously set header. The lookup is not case sensitive. However, the original name is returned.
method NextHeader(name As %String) as %String
Get the next header based on the upper case key used to store the headers.
classmethod NormalizeContentId(contentId As %String) as %String
Strip enclosing <> from Content-Id header. Input must already be stripped of lleading and trailing whitespace
classmethod NormalizeContentLocation(contentLocation As %String) as %String
Strip whitespace and comments from the Content-Location header. Input must already be stripped of lleading and trailing whitespace
method RemoveHeader(name As %String)
Remove a header to the MIME part.
method SetHeader(name As %String, value As %String)
Add a header to the MIME part. The basic Content headers that you may want are covered by properties of this class: Content-Type, Content-Transfer-Encoding, Content-Id and Content-Location.

Inherited Members

Inherited Methods


FeedbackOpens in a new tab