Examples: NotesMIMEHeader class

  1. This agent displays the names and values of the headers of a MIME entity.
    Sub Initialize
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim mime As NotesMIMEEntity
      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 mime = doc.GetMIMEEntity
        If Not(mime Is Nothing) Then
          Forall header In mime.HeaderObjects
            Messagebox header.GetHeaderVal(),, header.HeaderName
          End Forall
        Else
          Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
        End If
        Set doc = dc.GetNextDocument(doc)
      Wend
      s.ConvertMIME = True ' Restore conversion
    End Sub
  2. This agent displays all the Received headers of a MIME entity.
    Sub Initialize
      Dim s As New NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim mime As NotesMIMEEntity
      Dim header As NotesMIMEHeader
      Dim stream As NotesStream
      Set db = s.CurrentDatabase
      s.ConvertMIME = False ' Do not convert MIME to rich text|
      Set dc = db.UnprocessedDocuments
      Set doc = dc.GetFirstDocument
      If Not(doc Is Nothing) Then
        Set mime = doc.GetMIMEEntity
        If Not(mime Is Nothing) Then
          For i = 1 To 99
            Set header = mime.GetNthHeader("Received", i)
            If header Is Nothing Then Exit For
            Messagebox header.GetHeaderVal,, "Received # " & i
          Next
        Else
          Messagebox "Not MIME",, doc.GetItemValue("Subject")(0)
        End If
      End If
      s.ConvertMIME = True ' Restore conversion
    End Sub