Lotus Notes to send email from Access (1 Viewer)

uji_amira

New member
Local time
Tomorrow, 06:15
Joined
May 15, 2007
Messages
6
I use Microsoft Outlook to send email from Access. From Refrences In Msft Access, I tick Microsoft Outlook 9.0 object library. I declare mail object and item as below :

Dim EmailApp As Object
Dim NameSpace As Object
Dim EmailSend As MailItem

Set EmailApp = CreateObject("Outlook.Application")
Set NameSpace = EmailApp.GetNamespace("MAPI")
Set EmailSend = EmailApp.CreateItem(0)

EmailSend.To = MyTOEmail
EmailSend.CC = MyCCEmail

EmailSend.Subject = "For you attention"
EmailSend.body = bodystring
EmailSend.Send

Later we will upgrade our email to Lotus notes using Lotus notes clients. Can anyone tell me what I should do to enable Access use Notes instead to send email as above.

tq
 

Moniker

VBA Pro
Local time
Today, 17:15
Joined
Dec 21, 2006
Messages
1,567
I wouldn't exactly consider Lotus Notes from Outlook an upgrade, but I'd imagine there's an API that's included, and you'd have to access it the same way you currently access the Outlook object. I haven't used Notes since I was forced to about 10 years ago, but they have to have an API of some sort that's accessible to VB, VBA, C++, etc., and it will expose what I'm guessing will be similar methods, properties, etc. for using it similarly to how you now use the Outlook object.
 

allan57

Allan
Local time
Today, 22:15
Joined
Nov 29, 2004
Messages
336
Below is an example

Public Sub SendLotusNotesMail(strMailTitle As String, strLotusNotesUserID As String, strTextBody As String, Optional strFileAttachment As String = "", Optional fSaveMailToTheSentFolder As Boolean = False)

Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object

Dim strMailDbName As String

On Error Resume Next

'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")

'Open the mail database in Lotus Notes
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL

'Set up the new mail document
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.sendto = strLotusNotesUserID
objMailDocument.Subject = strMailTitle
objMailDocument.Body = strTextBody
objMailDocument.SAVEMESSAGEONSEND = fSaveMailToTheSentFolder

'Set up the embedded object and strFileAttachment and attach it
If strFileAttachment <> "" Then

Set objAttachment = objMailDocument.CreateRichTextItem("strFileAttachment")
Set objEmbedObject = objAttachment.EmbedObject(1454, "", strFileAttachment, "strFileAttachment")

End If

'Send the document
objMailDocument.SEND 0, strLotusNotesUserID

'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing

End Sub
 

aziz rasul

Active member
Local time
Today, 22:15
Joined
Jun 26, 2000
Messages
1,935
I've always used Outlook where I have worked in the past. But now I'm using Lotus Notes and I miss automating Outlook to send bulk emails. So this is great code. I look forward to using it soon.
 

ratbags21

Registered User.
Local time
Today, 22:15
Joined
Jun 28, 2007
Messages
10
Below is an example

Public Sub SendLotusNotesMail(strMailTitle As String, strLotusNotesUserID As String, strTextBody As String, Optional strFileAttachment As String = "", Optional fSaveMailToTheSentFolder As Boolean = False)

Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object

Dim strMailDbName As String

On Error Resume Next

'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")

'Open the mail database in Lotus Notes
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL

'Set up the new mail document
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.sendto = strLotusNotesUserID
objMailDocument.Subject = strMailTitle
objMailDocument.Body = strTextBody
objMailDocument.SAVEMESSAGEONSEND = fSaveMailToTheSentFolder

'Set up the embedded object and strFileAttachment and attach it
If strFileAttachment <> "" Then

Set objAttachment = objMailDocument.CreateRichTextItem("strFileAttachment")
Set objEmbedObject = objAttachment.EmbedObject(1454, "", strFileAttachment, "strFileAttachment")

End If

'Send the document
objMailDocument.SEND 0, strLotusNotesUserID

'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing

End Sub

Just put this code behind a button on a form and...zippo! Does not work
No errors though...
 

ratbags21

Registered User.
Local time
Today, 22:15
Joined
Jun 28, 2007
Messages
10
Just put this code behind a button on a form and...zippo! Does not work
No errors though...

Whoa! I stand corrected!! My test emails just arrived! Now we are in business! (I was expecting Lotus Notes to fire up during the process which obviously it does not)

Bravo! Not all I need to do is add an attachment!
 

Diavolo70

New member
Local time
Today, 22:15
Joined
Dec 10, 2007
Messages
2
Hi I am a bit of a novice when it come to access and VB. I have a query that returns a list of names with thier email addresses and I need to send an email to all in this list. So someone said put the code behind a button, does this mean if I run the query then click on the button it will send to all from the results I am a bit confused if someone could walk me through this I would much appriciate it. Thank you
 

ianclegg

Registered User.
Local time
Today, 22:15
Joined
Jul 14, 2001
Messages
58
Sending Mail Via Lotus Notes

Hi

Am I missing something, I have the same problem and need to automate mail using Lotus Notes. We are using the Version 7 Client and cannot get this code to work. Are there some additional references to add.

I have included in my list Lotus Domino Objects & Lotus Notes Automation Classes.

On opening the database I get the error - Procedure declaration does not match the description of event or procedure having the same name

Ian Clegg
 

rschnabl

Registered User.
Local time
Today, 15:15
Joined
Jun 10, 2004
Messages
11
I am worse than a beginner. I have copied this code and changed it to send me email but I can not get it to work right. It will snd me the email but not the attachment. Can someone look at it and tell me what I am doing wrong. I want it to send me the report rptCurrentWeldCertifications. It send the email correctly but soes not send the .htm attachment. I know it is probabbly something stupid but I can not find it.

Public Sub Report_Activate()


Dim objAttachment As Object
Dim objMailDb As Object
Dim objMailDocument As Object
Dim objEmbedObject As Object
Dim objNotesSession As Object

Dim strMailDbName As String

On Error Resume Next

'Start objNotesSession in Lotus Notes
Set objNotesSession = CreateObject("Notes.NotesSession")

'Open the mail database in Lotus Notes
Set objMailDb = objNotesSession.GETDATABASE("", strMailDbName)
objMailDb.OPENMAIL

'Set up the new mail document
Set objMailDocument = objMailDb.CREATEDOCUMENT
objMailDocument.Form = "Memo"
objMailDocument.sendto = "someone@yahhoo.com"
objMailDocument.Subject = "hello Dummy"
objMailDocument.body = "HHHH"
objMailDocument.SAVEMESSAGEONSEND = fSaveMailToTheSentFolder

'Set up the embedded object and strFileAttachment and attach it
If strFileAttachment <> "" Then

Set objAttachment = objMailDocument.HTM("rptCurrentWeldCertifications")
Set objEmbedObject = objAttachment.EMBEDOBJECT(1454, "", strFileAttachment, "rptCurrentWeldCertifications.HTM")

End If

'Send the document
objMailDocument.Send 0, strLotusNotesUserID

'Clean Up
Set objMailDb = Nothing
Set objMailDocument = Nothing
Set objAttachment = Nothing
Set objNotesSession = Nothing
Set objEmbedObject = Nothing

End Sub
 

renenger

Registered User.
Local time
Today, 15:15
Joined
Oct 25, 2002
Messages
117
What if you do not want the email to send. Just open with the attachments entered. I want the attachments to automatically embed and give the user an opportunity to review before actually sending. I am attaching 2 reports separately in the email which is why I would prefer not to make the user use the send email option already available in Access.
 

maw230

somewhat competent
Local time
Today, 17:15
Joined
Dec 9, 2009
Messages
522
Seven months since the last post, but I also need help using Lotus Notes to send an Access report...
 

Users who are viewing this thread

Top Bottom