LOTUSSCRIPT/COM/OLE CLASSES
Examples: NotesMIMEEntity class
1. This agent gets a MIME entity from the current document.
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
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 mime = doc.GetMIMEEntity
If Not(mime Is Nothing) Then
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
s.ConvertMIME = True ' Restore conversion
End Sub
2. This agent breaks down the MIME entity if it is multipart.
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Dim mime As NotesMIMEEntity
Dim child As NotesMIMEEntity
Dim m As String
Set db = s.CurrentDatabase
s.ConvertMIME = False
Set dc = db.UnprocessedDocuments
Set doc = dc.GetFirstDocument
While Not(doc Is Nothing)
Set mime = doc.GetMIMEEntity
If Not(mime Is Nothing) Then
If mime.ContentType = "multipart" Then
If mime.Preamble = "" Then
p$ = "No preamble"
Else
p$ = mime.Preamble
End If
Messagebox p$,, doc.GetItemValue("Subject")(0)
Set child = mime.GetFirstChildEntity
While Not(child Is Nothing)
Messagebox child.ContentAsText,, _
doc.GetItemValue("Subject")(0)
Set child = child.GetNextSibling
Wend
Else ' if not multipart
Messagebox mime.ContentAsText,, _
doc.GetItemValue("Subject")(0)
End If
Else ' if not MIME
Messagebox "Not MIME",, _
doc.GetItemValue("Subject")(0)
End If
Set doc = dc.GetNextDocument(doc)
Wend
s.ConvertMIME = True ' Restore conversion
End Sub
See Also
NotesMIMEEntity class
Glossary
Feedback on
Help
or
Product Usability
?
Help on Help
All Help Contents
Glossary