Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Close Notes

Close Notes

Close Notes

This is the VB.Net code I am using to automate the sending of an email through Lotus Notes..  we have all seen it before..

   Dim notesdb As Object
        Dim notesdoc As Object
        Dim notesrtf As Object
        Dim notessession As Object
        Dim avarrecip(1) As Object
        'Dim avarattach(1) As Object

        Dim bSuccess As Boolean = True


            'make new mail message

                notessession = GetObject(, "Notes.Notessession")
            Catch ex As Exception
                notessession = CreateObject("Notes.Notessession")

            End Try

            notesdb = notessession.GetDatabase("", "rwebser.nsf")

            '   notessession.Initialize("password")

            If Not notesdb.ISOPEN Then notesdb.OPENMAIL()

            notesdoc = notesdb.CREATEDOCUMENT
            Call notesdoc.ReplaceItemValue("Subject", sSubject)
            notesrtf = notesdoc.CreateRichTextItem("body")
            Call notesrtf.AppendText(sMessage)
            Call notesrtf.AddNewLine(2)

            '   Call notesrtf.EmbedObject(1454, "", avarattach(0), "Attachment")
            '  Call notesrtf.EmbedObject(1454, "", avarattach(1), "Attachment")

            'send message
            avarrecip(0) = sTo
            Call notesdoc.Send(False, avarrecip)

        Catch ex As Exception
            bSuccess = False
            notesdoc = Nothing
            notesrtf = Nothing
            notesdb = Nothing
            notessession = Nothing
        End Try

        Return bSuccess

My problem is that this code leaves the state of Lotus Notes in a mess.  When I run this code again everything works fine, but if I try to open up Notes manually, I get an error "An error was encountered while opening a window" which seems to be because the nlnotes.exe process is still in memory.  There is no close on notessession that I can tell and I have tried GC.Collect but that does't work.  So how do you clean up a notes object?

RE: Close Notes

You could use the LotusScript/com classes to automate the email without having to open up the notes client.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

RE: Close Notes

As in the Domino objects... yep...decided to do it that way.. works better.. thanks dwarfthrower.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close