?
Solved

Sending Mail to Lotus Notes

Posted on 1998-11-02
9
Medium Priority
?
557 Views
Last Modified: 2012-05-04
I need my VB Application to send a reminder email through our Lotus Notes email environment. Is there a way to programmitically set VB to do it? If so, please provide a code example. Thanks!
0
Comment
Question by:sehenkel
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 3

Expert Comment

by:jjmartin
ID: 1442954
This can be done.  I don't have the code on me right now, but I will post that tomorrow morning.
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1442955
Multiple ways.
You can use the MAPI control since notes is MAPI complaint or you can do it directly with notes.


Reference the Lotus Notes automation classes to your project and you will get complete control over notes.
0
 

Author Comment

by:sehenkel
ID: 1442956
Is it the NOTES32.TLB file? If so, could you provide me w/ some example code or some reference locations to use the Notes Automation classes?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Accepted Solution

by:
jjmartin earned 400 total points
ID: 1442957
The following code will email using you existing Lotus Notes.  Lotus Notes must be installed in teh machine, and in your project you must make reference to the Lotus Notes Automation Classes.  If Lotus Notes is not up at the time this is executed, it will bring up LN and prompt the user for their password.  Question for you thought; why can't you set up a Lotus Notes agent to send the email automatically?

'Email the information to the selected contact person
Private Sub cmdEmail_Click()

    Dim Resp As Integer
    Dim Server As String
    Dim UserDef As String
    Dim DefFile As String
    Dim NOTESSESSION As Object
    Dim NOTESDATABASE As Object
    Dim NOTESDOCUMENT As Object
    Dim NotesRichText As Object
   
    'Each person will have to have a different user definition file to access their Lotus Notes email.
    'This is kept in a text file or ini file for easier change and update.
    DefFile = App.Path + "\userdef.txt"
    Open DefFile For Input As #1
         Input #1, Server, UserDef
    Close #1
   
    'This is an example of what the definitions need to look like.
    'Server = "PHX_SHR_NOTES03/Blah Blah"
    'UserDef = "MAIL\jmartin.nsf"


            'Here is where we tag into the Lotus Notes email system to send the email.
            Set NOTESSESSION = CreateObject("Notes.NotesSession")
            Set NOTESDATABASE = NOTESSESSION.GETDATABASE(Server, UserDef)
            'This is an example of what this looks like without the variables.
            'Set NotesDatabase = NotesSession.GetDatabase("PHX_SHR_NOTES03/American Express", "MAIL\jmartin.nsf")
            Set NOTESDOCUMENT = NOTESDATABASE.CREATEDOCUMENT
            Set NotesRichText = NOTESDOCUMENT.CREATERICHTEXTITEM("Body")

            NOTESDOCUMENT.Subject = txtSubject.Text 'This is the subject of the email an appears in the subject line
            NOTESDOCUMENT.Body = txtMessage.Text   'This is the actual message of the email
            NOTESDOCUMENT.SendTo = Email(lstNames.ListIndex)    'Here is the email address of the person your emailing to.
            NOTESDOCUMENT.SAVEMESSAGEONSEND = False 'This has to be set to False or we get errors
            NOTESDOCUMENT.SEND False    'Keep this set to false.

   
End Sub
0
 

Author Comment

by:sehenkel
ID: 1442958
Ok, I tried the code and I get a runtime error 429:" Active X component can't create object."

When debugging, this is the line that has the problem:

Set NOTESSESSION = CreateObject("Notes.NotesSession")

Now I placed the NOTES32.TLB file in the program references. Is there anything else I need to do? Thanks in advance.
0
 

Author Comment

by:sehenkel
ID: 1442959
Ok, I tried the code and I get a runtime error 429:" Active X component can't create object."

When debugging, this is the line that has the problem:

Set NOTESSESSION = CreateObject("Notes.NotesSession")

Now I placed the NOTES32.TLB file in the program references. Is there anything else I need to do? Thanks in advance.
0
 
LVL 3

Expert Comment

by:jjmartin
ID: 1442960
Give this a try, I confirmed that it is working on my PC.

Private Sub Command1_Click()
' Under Project|References, you must check the references to Lotus Notes Automation Classes
Set NOTESSESSION = CreateObject("Notes.NotesSession")
'The first set of quotes contains the database location, the second set contains the nsf file for the
'individual user.  This is specific for each user.  In a full fledged application, I save that in an
'ini file that is read in at run time.
Set NOTESDATABASE = NOTESSESSION.GetDatabase("PHX_SHR_NOTES03/American Express", "MAIL\jmartin.nsf")
Set NOTESDOCUMENT = NOTESDATABASE.CreateDocument
Set NotesRichText = NOTESDOCUMENT.CreateRichTextItem("Body")

NOTESDOCUMENT.Subject = "Testing"
NOTESDOCUMENT.Body = "Attached file is here"
NOTESDOCUMENT.SendTo = "Jason J Martin"
NOTESDOCUMENT.savemessageonsend = True
NOTESDOCUMENT.send False

End Sub

0
 

Author Comment

by:sehenkel
ID: 1442961
Same problem. Its the following line that's causing a problem:

Set NOTESSESSION = CreateObject("Notes.NotesSession")


Any other thoughts??
0
 

Author Comment

by:sehenkel
ID: 1442962
I had to run the NOTESW32.REG file and the code worked perfectly. Thanks for all of your help!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

800 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