Public Sub sendNotes()
Dim recep As String() = ssMailTo
Dim ccRecipient As String() = New String() {}
Dim subj As String = sSubjectSend
Dim mailbody As String = "" '"hi" + ControlChars.NewLine + "bye"
Dim savemsg As Boolean
open()
Dim domNotesDocumentMemo As NOTESDOCUMENT
Dim DomNotesItem As NOTESITEM
Dim sUser As String
Dim objNotesRichTextItem As NOTESRICHTEXTITEM
' Create a new memo document.
domNotesDocumentMemo = domDB.CreateDocument
'Call domNotesDocumentMemo.AppendItemValue("Form", "Memo")
'Call domNotesDocumentMemo.AppendItemValue("Form", "Mail")
Call domNotesDocumentMemo.AppendItemValue("From", domS.CommonUserName)
Call domNotesDocumentMemo.AppendItemValue("SendTo", "")
'Now get a handle on the item
DomNotesItem = domNotesDocumentMemo.GetFirstItem("SendTo")
'Now pass your array
For Each r As String In recep
If r <> "" Then
Call DomNotesItem.AppendToTextList(r)
End If
Next
'create or instantiate the item
Call domNotesDocumentMemo.AppendItemValue("CopyTo", "")
'Now get a handle on the item
DomNotesItem = domNotesDocumentMemo.GetFirstItem("CopyTo")
'Now pass your array
For Each s As String In ccRecipient
If s <> "" Then
Call DomNotesItem.AppendToTextList(s)
End If
Next
Call domNotesDocumentMemo.AppendItemValue("Subject", subj)
objNotesRichTextItem = domNotesDocumentMemo.CreateRichTextItem("Body")
Call objNotesRichTextItem.AppendText(mailbody)
If Trim(LCase(savemsg)) = "yes" Then
domNotesDocumentMemo.SaveMessageOnSend = True
Else
domNotesDocumentMemo.SaveMessageOnSend = False
End If
domNotesDocumentMemo.Send(False)
domNotesDocumentMemo = Nothing
close()
End Sub
Function open() As Boolean
IO.File.Copy(IO.Path.Combine(IO.Directory.GetCurrentDirectory, sIDfilePath), IO.Path.Combine(notesDataPath, sIDfilePath), True)
IO.File.Copy(IO.Path.Combine(IO.Directory.GetCurrentDirectory, "notes.ini"), IO.Path.Combine(notesPath, "notes.ini"), True)
WritePrivateProfileString("Notes", "KeyFilename", IO.Path.Combine(notesDataPath, sIDfilePath), IO.Path.Combine(notesPath, "notes.ini"))
WritePrivateProfileString("Notes", "MailFile", sPfile, IO.Path.Combine(notesPath, "notes.ini"))
domS = New NOTESSESSION
'domS = CreateObject("lotus.NotesSession")
'domS = GetObject("", "Notes.Notesession")
Call domS.Initialize(sPpassword)
'System.Threading.Thread.Sleep(2000)
domDB = domS.GetDatabase(sPserver, sPfile)
'System.Threading.Thread.Sleep(2000)
Return True
End Function
Sub close()
domDB = Nothing
domS = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
End Sub
|