Solved

Lotus Notes Email automation

Posted on 2001-07-04
5
649 Views
Last Modified: 2007-11-27
Guys

I have an app, that will reside on a network that uses lotus notes as its email app.

I need to automate an email within my app when certain things happen.  Now I know how to do this with outlook and the mapi object, thats a doddle, but I have never tried this before.

I have a type lib file called domobj.tlb (lotus domino object), and I am not too sure whether this is good or not.

What I need to know is what DLL, TLB file do I need and also a quick snipet of code on how I would go about this.

Also if you have the dll file, then maybe you could email it to me, but we will cross that bridge when we get to it.

Cheers,

Ray.
0
Comment
Question by:raybetts
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:sridhar_PJ
ID: 6254417
Hi raybetts,
   If u want to send mails without using lotus client use vbsendmail object from www.freevbcode.com . It is available in http://www.freevbcode.com/ShowCode.Asp?ID=109


A simple method to send mail use lotus client object use this code.

Private Sub cmdSend_Click()
    Dim s As Object
    Dim db As Object
    Dim doc As Object
    Dim sMsg As String
   
's and db declared in general as object
    Set s = CreateObject("Notes.Notessession")    'create notes session
    Set db = s.getdatabase("", "")                'set db to database not yet named
    Call db.openmail                              'set database to default mail database
    Set doc = db.createdocument                   'notesdocument '.New  '(db)   ' create a mail document
    sMsg = "Mail has been sent: " & Date & "  " & Time & Chr(10) & "This is a test of an email message from VB." & vbCrLf & Text1.Text
'  Call doc.replaceitemvalue("SendTo", "Gary Devendorf/CAM/Lotus@Lotus") Hard coding address
  'Call doc.replaceitemvalue("SendTo", s.UserName) 'Notes client's user name (for testing)
    Call doc.replaceitemvalue("SendTo", "Eric Burdo")
    Call doc.replaceitemvalue("Subject", "VB message")
    Call doc.replaceitemvalue("Body", sMsg)
    Call doc.Send(False)                          'send the message
    MsgBox doc.getitemvalue("Body")(0)
    Set s = Nothing                               ' close connection to free memory
    Set db = Nothing
    Set doc = Nothing
End Sub


By the way what version of server u have
If u have Lotus Notes and Domino Release 5.0.2b then follow the method to send the mails

Link Lotus Notes to Visual Basic 6.0

With the introduction of Lotus Notes and Domino Release 5.0.2b, you now have the ability to manipulate the Domino object model via COM. As a result, you can use VB 6.0 to take advantage of Lotus/Domino services and databases.

To do so, however, you'll need Lotus Notes client version 5.02.b (or higher), Domino Designer client, or Domino Server. As with most Visual Basic object libraries, the programs need not be running to use them. Lotus has plans to make this runtime package distributable independent of its full software installation.

Next, set a reference to the Notes back-end DLL, Lotus Domino Objects. This object model conforms to a hierarchy similar to CDONTS, as seen in the sample code, which displays a message box with the first name in a Lotus Notes' address book. Notice that before you can access any of the objects within the NotesSession, you must initialize a session first.

Dim domSession As New Domino.NotesSession    
Dim domDatabase As New Domino.NotesDatabase
Dim domDocument As NotesDocument
Dim domViewEntry As NotesViewEntry
Dim domView As NotesView
Dim domViewNav As NotesViewNavigator
Dim strName As String

domSession.Initialize
Set domDatabase = domSession.GetDatabase("", _
     "names.nsf")  
Set domView = domDatabase.GetView("Contacts")
' This view contains the list of names
Set domViewNav = domView.CreateViewNav
Set domViewEntry = domViewNav.GetFirstDocument()
Set domDocument = domViewEntry.Document

strName = domDocument.GetItemValue("FullName")(0)
MsgBox strName

Set domViewEntry = Nothing
Set domViewNav = Nothing
Set domView = Nothing
Set domDocument = Nothing
Set domDatabase = Nothing
Set domSession = Nothing



Bye
Sridhar


0
 
LVL 43

Expert Comment

by:TimCottee
ID: 6255810
On my site in the downloads section http://www.geocities.com/TimCottee

There is a sample module which can simply be added to an existing project. This allows emails to be sent with Notes 4.x and 5.x. It includes the ability to send to multiple addressees and also include multiple attachments. All you need to do is add the module and then use the SendNotesMail function with the appropriate parameters. Attachment, SendTo, CC and BCC fields can include multiple elements seperated by commas.

Hope it helps.
0
 
LVL 1

Author Comment

by:raybetts
ID: 6256856
Thanks guys for what seems very good pointers, give me a week (roughly) and I will be back to award some points.  Thanks again for what seems to be very thorough answers.

Ray.
0
 
LVL 43

Accepted Solution

by:
TimCottee earned 300 total points
ID: 6285101
Ray, how is it going?
0
 
LVL 1

Author Comment

by:raybetts
ID: 6287195
Worked a treat.

Cheers.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question