[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Lotus Notes Email automation

Posted on 2001-07-04
5
Medium Priority
?
685 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 1200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…
Suggested Courses
Course of the Month18 days, 18 hours left to enroll

834 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