class %Net.MIMEPart
extends %RegisteredObject
%Net.MIMEPart holds a MIME message part
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 Boundary
as %String(MAXLEN="");
Boundary to used to separate parts of the message.
If none is specified, a default is created.
property ContentCharset
as %String(MAXLEN="") [ 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 ContentId
as %String(MAXLEN="");
The normalized content-id.
Any leading or trailing whitespace and enclosing <> are removed.
property ContentLocation
as %String(MAXLEN="");
The normalized content-location.
Any leading or trailing whitespace and comments are removed.
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 ContentType
as %String(MAXLEN="") [ 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 PartOwnedStream
as %Boolean;
If PartOwnedStream is true, then the part owns the stream and should cleasr it when
the part is deleted.
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.
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
This is a Get accessor method for the Boundary property.
method ClearHeaders()
as %Status
Clear the list of headers
method ContentCharsetGet()
as %String
This is a Get accessor method for the ContentCharset property.
method ContentCharsetSet(charset As %String)
as %Status
This is a Set accessor method for the ContentCharset property.
method ContentIdSet(value As %String)
as %Status
This is a Set accessor method for the ContentId property.
method ContentLocationSet(value As %String)
as %Status
This is a Set accessor method for the ContentLocation property.
method ContentTransferEncodingGet()
as %String
This is a Get accessor method for the ContentTransferEncoding property.
method ContentTransferEncodingSet(value As %String)
as %Status
This is a Set accessor method for the ContentTransferEncoding property.
method ContentTypeGet()
as %String
This is a Get accessor method for the ContentType property.
method ContentTypeSet(contenttype As %String)
as %Status
This is a Set accessor method for the ContentType property.
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.