Solved

Lotus Notes Email automation

Posted on 2001-07-04
5
641 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now