Examples: SetContentFromText method
This agent creates a document in MIME format.
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim body As NotesMIMEEntity
Dim stream As NotesStream
Set db = s.CurrentDatabase
s.ConvertMIME = False ' Do not convert MIME to rich text
Set doc = db.CreateDocument
Call doc.ReplaceItemValue("Form", "Main Form")
Set body = doc.CreateMIMEEntity
Set header = body.CreateHeader("Subject")
Call header.SetHeaderVal("MIME one-part message")
Set stream = s.CreateStream
Call stream.WriteText("Text of message.")
Call body.SetContentFromText _
(stream, "text/plain;charset=UTF-8", ENC_IDENTITY_7BIT)
Call doc.Save(True, True)
s.ConvertMIME = True ' Restore conversion
End Sub