Examples: GetMIMEEntity method (NotesItem - LotusScript®)

This agent gets a MIME entity from a "Body" item.

Sub Initialize
  Dim s As New NotesSession
  Dim db As NotesDatabase
  Dim dc As NotesDocumentCollection
  Dim doc As NotesDocument
  Dim body As NotesItem
  Dim mime As NotesMIMEEntity
  Dim m As String
  Set db = s.CurrentDatabase
  s.ConvertMIME = False ' Do not convert MIME to rich text|
  Set dc = db.UnprocessedDocuments
  Set doc = dc.GetFirstDocument
  While Not(doc Is Nothing)
    Set body = doc.GetFirstItem("Body")
    If body.Type = MIME_PART Then
      Set mime = body.GetMIMEEntity
      m = "Content type:" & Chr(9) & _
      mime.ContentType & Chr(13) & _
      "Content subtype:" & Chr(9) & _
      mime.ContentSubtype & Chr(13) & _
      "Character set:" & Chr(9) & _
      mime.CharSet & Chr(13) & _
      "Encoding:" & Chr(9) & Chr(9) & _
      mime.Encoding
      Messagebox m,, doc.GetItemValue("Subject")(0)
      Messagebox mime.Headers,, "Headers"
      Messagebox mime.ContentAsText,, "Content as text"
    Else
      Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
    End If
    Set doc = dc.GetNextDocument(doc)
  Wend
End Sub