Hello,
I have issue with my code and that is that mail is not saved in the “sent” view after I send it.
I am using lotus.notessession and here is the code:
Sub mailsendervar2(EmailRecipient As Variant, EmailSubject As String, pathToFile As String)
Dim Maildb As Object
Dim MailDoc As Object
Dim Body As Object
Dim Session As Object
'Start a session to notes
Set Session = CreateObject(“Lotus.NotesSession”)
'This line prompts for password of current ID noted in Notes.INI
'Call Session.Initialize
'or use below to supply password of the current ID
Call Session.Initialize(“MYPASSWORD”)
'Open the mail database in notes
Set Maildb = Session.GetDatabase(“”, “MYNSFFILE”)
If Not Maildb.IsOpen = True Then
Call Maildb.Open
End If
'Create the mail document
Set MailDoc = Maildb.CreateDocument
Call MailDoc.ReplaceItemValue(“Form”, “Memo”)
'Set the recipient
Call MailDoc.ReplaceItemValue(“SendTo”, EmailRecipient)
'Set subject
Call MailDoc.ReplaceItemValue(“Subject”, EmailSubject)
'Create and set the Body content
Set Body = MailDoc.CreateRichTextItem(“Body”)
Call Body.AppendText(“”)
'Example to create an attachment (optional)
Call Body.AddNewLine(2)
Call Body.EmbedObject(1454, “”, pathToFile, “Attachment”)
'Example to save the message (optional)
MailDoc.SaveMessageOnSend = True
'Send the document
'Gets the mail to appear in the Sent items folder
Call MailDoc.ReplaceItemValue(“PostedDate”, Now())
Call MailDoc.Send(False)
'Clean Up
Set Maildb = Nothing
Set MailDoc = Nothing
Set Body = Nothing
Set Session = Nothing
End Sub
The mail is sent correctly, but I want to save it in the sent view as well.