• Automated E-Mails with Lotus Notes (Access 2002)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Automated E-Mails with Lotus Notes (Access 2002)

    Author
    Topic
    #379119

    Hello,
    I would like to create automated E-Mails from the contents of an Access table which will contain E-MAil adresses and a file-name to be sent.
    I found a library called “Domino”, but there is no documentation available how to use Office (XP) Automation with Lotus Notes (without Outlook).
    Anyone able to help? I’m sure there is at least one among all the cracks here.
    hello

    Viewing 0 reply threads
    Author
    Replies
    • #630207

      Horst,

      Unfortunately I can’t help, but I will give you a word of warning that I got from out Lotus Notes Developer (We don’t use it for mail, but for a “database”)

      If you are using Notes R5 of higher, it should be doable. If it is version 4.x you will probably have some challenges. 4.x doesn’t play well with automation, at least according to our Notes Developer. R5 is supposed to have VBA integrated with it, but I can’t confirm that since I only have 4.6

      I know this isn’t much help.

      • #631404

        Thanks, we are using Version 5.0 barf

        • #631455

          Horst,
          Here is the code I use to send an email with an attachment:
          Function SendLotus(Attachment) ‘sends an email with an attachment
          Dim S As Object
          Dim db As Object
          Dim doc As Object
          Dim rtItem As Object
          Dim Server As String, Database As String
          Dim strError As String

          ‘ start up Lotus Notes and get object handle
          Set S = CreateObject(“Notes.NotesSession”)
          Server = S.GETENVIRONMENTSTRING(“MailServer”, True)
          Database = S.GETENVIRONMENTSTRING(“MailFile”, True)
          Set db = S.GETDATABASE(Server, Database)

          On Error GoTo ErrorLogon
          ‘ See if user is logged on yet;
          ‘ if not, the error handler will kick in!
          Set doc = db.CREATEDOCUMENT
          On Error GoTo 0

          doc.Form = “Memo”
          doc.Importance = “1” ‘(WHERE 1=URGENT, 2= NORMAL, 3=FYI)

          ‘Send an EMail to
          doc.SENDTO = (“firstaddress@somewhere.com”,”secondaddress@somewhere.com”)
          ‘SENDS A RETURN RECIEPT
          ‘doc.RETURNRECIEPT = “1”
          doc.Subject = “Place your subject text here”

          ‘ this will build the text part of your mail message

          Set rtItem = doc.CREATERICHTEXTITEM(“Body”)
          Call rtItem.APPENDTEXT(GetBody)
          Call rtItem.ADDNEWLINE(1)

          ‘Attach a document!
          Call rtItem.EMBEDOBJECT(1454, “”, Attachment)

          Call doc.send(False) ‘Make sure this parameter stays false

          ‘ set all object handles to nothing to release memory
          Set doc = Nothing
          Set db = Nothing
          Set S = Nothing
          Set rtItem = Nothing

          MsgBox “Mail has been sent!”, vbInformation

          Exit Function

          ErrorLogon:
          If ERR.NUMBER = 7063 Then
          MsgBox “Please login to Lotus Notes first!”, vbCritical
          Set doc = Nothing
          Set db = Nothing
          Set S = Nothing
          Set rtItem = Nothing

          Exit Function
          Else
          strError = “An Error has occurred on your system:” & vbCrLf
          strError = strError & “Err. Number: ” & ERR.NUMBER & vbCrLf
          strError = strError & “Description: ” & ERR.Description
          MsgBox strError, vbCritical
          Set doc = Nothing
          Set db = Nothing
          Set S = Nothing
          Set rtItem = Nothing

          Exit Function
          End If

          End Function
          Usage SendLotus “C:yourdocument.doc”

          • #631473

            Thanks, eyeout
            what library did you use?
            I found 2, one is called “Lotus Domino Objects”, the other one “Lotus Notes Automation Classes” with the main difference that the latter does not contain the constants.
            Is there any written documentation available on how to automate with LN?

          • #985650

            Hi,

            I found this post while searching on automation for Lotus Notes. Code work great but is there a way to get the email to open
            and view it before it sends. That is, the email is created and automatically sends but I want to populate all data and have the email
            visible before sending in the event the body needs to be edited. The user physically send the email after it is created.

            Thanks.

            • #989254

              I was going to apologise about the time-delay in replying, but I’m not sure that’s necessary? grin

              I was hoping that you could do it by amending the code:

              ‘~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              Call doc.Save(False, False)
              Call doc.SEND(False, doc.SendTo)
              ‘~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

              to

              ‘~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
              Call doc.Save(False, False)
              Call doc.Activate
              ‘~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

              However, .Activate is not a method of the NotesDocument Class: doc.Save does, however, put the document in the draft folder, so you could navigate to that and open it manually…

              My mind is fuzzy when it comes to notes, but I’m sure I remember seeing code that does activate/open a document in the User interface, but I can’t find how to do it using NotesDocuments or NotesItems. It may be possible to get at the draft by the NotesUIView class so that you can then activate it using one of the other NotesUI classes. I’ll keep looking for you, but I’m afraid I can’t promise anything. Hopefully the manually opening the draft will tide you over.

            • #989323

              Thanks again Brooke. I changed the design of the structure such that the body of the email was reviewed prior to sending so the email would not need to be reviewed when sending to each individual since I couldn’t solve the limitation on the 256 characters in the Send Object.

              Ultimately, here is what I did.

              1. Users select a listing of users to send an email to
              2. Users Press a button to create a .PDF of a report and write it to their local drive
              3. Users press a button to send email that loop through each name, create the email, attach the .PDF and send out the Lotus Notes email.

    Viewing 0 reply threads
    Reply To: Automated E-Mails with Lotus Notes (Access 2002)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: