Skip to main content
This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.
Information Mgmt
New to Lotus
How to buy
Live demos
Technical library
Forums & community
Java™ technology
Open source
SOA and Web services
Web development
My developerWorks
About dW
Submit content

developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum



PreviousPrevious NextNext

Marcel Muller 25.Oct.16 03:55 AM a Web browser
Notes Client All Releases All Platforms


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.

VBA Macro - how to save sent mail i... (Marcel Muller 25.Oct.16)
. . I think you need to save your docum... (Carl Tyler 25.Oct.16)
. . . . RE: I think you need to save your d... (Marcel Muller 26.Oct.16)
. . . . . . But I think you are doing this as a... (Carl Tyler 26.Oct.16)

  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Advanced search

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds


Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds


IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums

 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite