Sub ComposeNotesMail()
Dim sess As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim body As Object
Dim mailServer As String, mailFile As String
Dim list(2) As String
' Init Notes session
Call sess.Initialize("pass")
' Open user's email
mailServer = sess.GetEnvironmentString("MailServer", True)
mailFile = sess.GetEnvironmentString("MailFile", True)
db = sess.GetDatabase(mailServer, mailFile)
If db.IsOpen Then
doc = db.CreateDocument
Else
MsgBox("Could not open Notes", 32)
End If
'list(0) = ("User1")
'list(1) = ("User2")
' Create an email doc
doc = db.CreateDocument
Call doc.ReplaceItemValue("Form", "Memo")
Call doc.ReplaceItemValue("SendTo", "list")
'Call doc.ReplaceItemValue("CopyTo", "")
Call doc.ReplaceItemValue("Subject", "new mail")
body = doc.CreateRichTextItem("BODY")
Call body.AppendText(TextBox1.Text)
'Call body.AddNewLine()
'Call body.AddNewLine()
doc.SaveMessageOnSend = True
Call doc.Send(False)
doc.SaveMessageOnSend = True
sess = Nothing
db = Nothing
doc = Nothing
End Sub
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.