Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send email in lotus notes from Access (VBA) 1

Status
Not open for further replies.

lcrawford46

Programmer
Sep 19, 2002
9
US
Need help to send an email in Lotus Notes from Access. Tried the following code but get an error. Need to open/create a new message. Please help.
Code:
        'define objects
        Set objNotes = GetObject("", "Notes.Notesession")
        Set objNotesDB = objNotes.getdatabase("", "")
                            
        Call objNotesDB.openmail
        Set objNotesMailDoc = objNotesDB.CreateDocument
                            
        Call objNotesMailDoc.replaceitemvalue("SendTo", strAddress)
        Call objNotesMailDoc.replaceitemvalue("Subject", strSubj)
        Call objNotesMailDoc.replaceitemvalue("Body", strBody)
                            
        Call objNotesMailDoc.Send(True)
                            
        MsgBox "mail OK", vbInformation, "Sender notes-mail..."
        
        Set objNotes = Nothing
 
Dim rst As Recordset
Dim notesdb As Object
Dim notesdoc As Object
Dim notesrtf As Object
Dim notessession As Object
Dim avarrecip() As Variant
Dim avarattach(1) As Variant
Dim i As Integer


'make new mail message
Set notessession = CreateObject("Notes.Notessession")
Set notesdb = notessession.GetDatabase("", "")
Call notesdb.OPENMAIL
Set notesdoc = notesdb.CreateDocument
Call notesdoc.ReplaceItemValue("Subject", "Put Subject Here")
Set notesrtf = notesdoc.CreateRichTextItem("body")
Call notesrtf.AppendText("Add Additional text here.")
Call notesrtf.AddNewLine(2)

Call notesrtf.EmbedObject(1454, "", avarattach(0), "Attachment")
Call notesrtf.EmbedObject(1454, "", avarattach(1), "Attachment")

'send message
Call notesdoc.Send(False, avarrecip)
Call LogEvent("Emails Sent to " & ListSelection & ".") 'log event
Msgbox "Email sent.", vbOKOnly + vbInformation, "Email Sent"
Set notessession = Nothing
 
That's impressive! I do VBA from Delphi to Excel and Word, but have never had reason to call Lotus Notes. A star for you!!

Leslie
landrews@metrocourt.state.nm.us

There are 10 types of people in the world -
those who understand binary
and
those who don't!
 
I am trying to send an email via Lotus Notes in ACCESS 2000 in the backgroud when a specific date has been reached. I want to attach a query to the email (basically a list of documents they need to verify). Thanks!

-Laughter works miracles.
 
On the lotus site, search for DCO. There is a VBA example for free there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top