Solved

Lotus Notes Email automation

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

912 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

27 Experts available now in Live!

Get 1:1 Help Now