Preamble (NotesMIMEEntity - JavaScript™)
Read-write. Preamble of a MIME multipart entity.
Defined in
NotesMIMEEntitySyntax
getPreamble() : string
setPreamble(preamble:string) : void
Usage
This property contains additional information that can precede the first child entity of a multipart MIME entity according to RFC-2046.This property applies where multipart
is
the Content-Type. Otherwise, this property is an empty string.
Domino® includes the preamble at the beginning of the text of a MIME item.
For the parent entity in a multipart entity, getContentAsText returns the preamble.
Setting the preamble automatically appends a carriage return and line feed, replacing any explicit trailing carriage return and line feed characters.
Examples
This button displays the content of the current document if it is in MIME format.// Do not automatically convert MIME to rich text
session.setConvertMIME(false);
var mime:NotesMIMEEntity = currentDocument.getDocument().getMIMEEntity();
if (mime != null) {
// If multipart MIME entity
if (mime.getContentType().equals("multipart")) {
// Print preamble
if (!mime.getPreamble().equals("")) {
requestScope.status = "Preamble:\t" + mime.getPreamble() + "\n";
}
// Print content of each child entity
var child1:NotesMIMEEntity = mime.getFirstChildEntity();
while (child1 != null) {
requestScope.status +=
child1.getBoundaryStart() + child1.getContentAsText() +
child1.getBoundaryEnd() + "\n";
var child2:NotesMIMEEntity = child1.getFirstChildEntity();
if (child2 == null) {
child2 = child1.getNextSibling();
if (child2 == null) {
child2 = child1.getParentEntity();
if (child2 != null) {
child2 = child2.getNextSibling();
}
}
}
child1 = child2;
}
}
// If not multipart, just print content
else {
requestScope.status = mime.getContentAsText();
}
} else {
requestScope.status = "Not MIME";
}
// Restore conversion
session.setConvertMIME(true);
This button mails a document
in MIME format.
var stream:NotesStream = session.createStream();
// Do not automatically convert MIME to rich text
session.setConvertMIME(false);
var doc:NotesDocument = database.createDocument();
// Create parent entity
doc.replaceItemValue("Form", "Memo");
var body:NotesMIMEEntity = doc.createMIMEEntity();
var header:NotesMIMEHeader = body.createHeader("Content-Type");
header.setHeaderVal("multipart/mixed");
header = body.createHeader("Subject");
header.setHeaderVal("MIME message");
header = body.createHeader("To");
header.setHeaderVal(requestScope.query);
// Create preamble
body.setPreamble("Preamble to multipart message.\n");
// Create first child entity
var child:NotesMIMEEntity = body.createChildEntity();
stream.writeText("Text of message for child 1.\n");
child.setContentFromText(stream, "text/plain", NotesMIMEEntity.ENC_NONE);
stream.truncate();
// Create second child entity
child = body.createChildEntity();
stream.writeText("Text of message for child 2.\n");
child.setContentFromText(stream, "text/plain", NotesMIMEEntity.ENC_NONE);
doc.send(false);
// Restore conversion
session.setConvertMIME(true);