createHeader (NotesMIMEEntity - JavaScript)

Creates a MIME header and returns its representation as an object.

Defined in

NotesMIMEEntity

Syntax

createHeader(headerName:string) : NotesMIMEHeader
Parameter Description
headerName The name of the header.
Return value Description
NotesMIMEHeader The new MIME header.

Usage

The MIME header applies to the calling MIME entity.

The new MIME header has only a name. It has no value or parameters.

This method returns null if creation of the header exceeds a known limit for headers of the same name.

The methods setContentFromBytes and setContentFromText generate Content-Type and Content-Transfer-Encoding headers. The method encodeContent generates Content-Transfer-Encoding headers.

Examples

This button creates a multipart MIME entity and sends it as a mail memo.
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 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.");
child.setContentFromText(stream, "text/plain", NotesMIMEEntity.ENC_NONE);
doc.send(false);
// Restore conversion
session.setConvertMIME(true);