• send lotus note email from listbox (a97)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » send lotus note email from listbox (a97)

    Author
    Topic
    #387900

    I hv created a listbox with 2 columns whereby display all the email addresses in first column and names on the second column. I want to send an email by selecting email address and it will open lotus email. Once the email is open, the email address will auto add to the send to field. May I know is it possible to do in such a matter as I explained?If yes, so how to go about it? pls help..tks.. dizzy

    Viewing 0 reply threads
    Author
    Replies
    • #678990

      I have some code that will send emails using Lotus notes 5.0 from within Access. The email address portion of your listbox is no problem but what do you want to place in the subject line and the body of the email. Where will this info come from? Otherwise you will be sending a blank email to someone.

      • #679063

        Tht means besides of just create to open lotus email, it can also do more than tht? At first, I was thought only once the lotus email is open, I will key in there in the subject line and the body of the email. If Access can do include the subject line and body as well, then what if i create 2 textbox to input subject line and another for body of the email? Is that what I understanding is correct. If so, I can send email direct from Access instead? dizzy bubbles shrug

        • #679152

          Take a look at this database.
          I put together a small demo of sending an Email from Access through Lotus Notes using a listbox.
          The table for the listbox source has the email, subject, and message. I don’t have Access97 so I converted it from 2000.(it should work)
          Later,
          Scott

          • #797754

            Hi Scott, Nice Code! I am trying to build an app that can use Notes or outlook depending on the users installation.
            Do you know how to determine the mail client please?
            thanks.
            Brian.

            • #797762

              Brian,
              I never had to check for that since we use Lotus company wide.
              don’t know if this is want you want but….
              you can use a hyperlink to bring up the default mail client
              e.g. mailto: Me@woodys.com
              the link will open up your default mail client

            • #797763

              Brian,
              I never had to check for that since we use Lotus company wide.
              don’t know if this is want you want but….
              you can use a hyperlink to bring up the default mail client
              e.g. mailto: Me@woodys.com
              the link will open up your default mail client

          • #797755

            Hi Scott, Nice Code! I am trying to build an app that can use Notes or outlook depending on the users installation.
            Do you know how to determine the mail client please?
            thanks.
            Brian.

          • #848672

            Can someone tell me how to send an attachment with the code that is used to send an email in this database. The following code comes from that database.

            Private Sub cmdSEND_Click()
                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
                Dim Item As String
                Dim strWHERE As Variant
                Dim strEMAIL As String
                Dim strSUBJECT As String
                Dim strMSG As String
                
                If Me.lstEMAIL.ItemsSelected.Count = 0 Then
                    MsgBox "You must select at least destination"
                    Exit Sub
                End If
                
                strWHERE = strWHERE & lstEMAIL.Column(0, Item)
                strSUBJECT = strSUBJECT & lstEMAIL.Column(1, Item)
                strMSG = strMSG & lstEMAIL.Column(2, Item)
            
                ' start up Lotus Notes and get object handle passwords and ID
                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 = (strWHERE)
            
                'SENDS A RETURN RECIEPT
                'doc.RETURNRECIEPT = "1"
                Doc.Subject = strSUBJECT
                
                ' this will build the text part of your mail message
            
                Set rtItem = Doc.CREATERICHTEXTITEM("Body")
                Call rtItem.APPENDTEXT(strMSG)
                Call rtItem.ADDNEWLINE(1)
                
                'Attach a document!
                
                'Call rtItem.embedobject(1454, "", Attachment)
                '' set all object handles to nothing to release memory
                Call Doc.send(False) 'Make sure this parameter stays false
                Set Doc = Nothing
                Set db = Nothing
                Set s = Nothing
                Set rtItem = Nothing
                
                MsgBox "Mail has been sent!", vbInformation
            
                Exit Sub
            ErrorLogon:
                If Err.Number = 7063 Then
                    MsgBox "Please login to Lotus Notes first!", vbCritical
                    Set Doc = Nothing
                    Set s = Nothing
                    Set rtItem = Nothing
                    
                    Exit Sub
                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 s = Nothing
                    Set rtItem = Nothing
                    Exit Sub
                End If
                    
            End Sub
            

            I have bolded an instruction above, is this the way to include an attachment?

          • #848673

            Can someone tell me how to send an attachment with the code that is used to send an email in this database. The following code comes from that database.

            Private Sub cmdSEND_Click()
                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
                Dim Item As String
                Dim strWHERE As Variant
                Dim strEMAIL As String
                Dim strSUBJECT As String
                Dim strMSG As String
                
                If Me.lstEMAIL.ItemsSelected.Count = 0 Then
                    MsgBox "You must select at least destination"
                    Exit Sub
                End If
                
                strWHERE = strWHERE & lstEMAIL.Column(0, Item)
                strSUBJECT = strSUBJECT & lstEMAIL.Column(1, Item)
                strMSG = strMSG & lstEMAIL.Column(2, Item)
            
                ' start up Lotus Notes and get object handle passwords and ID
                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 = (strWHERE)
            
                'SENDS A RETURN RECIEPT
                'doc.RETURNRECIEPT = "1"
                Doc.Subject = strSUBJECT
                
                ' this will build the text part of your mail message
            
                Set rtItem = Doc.CREATERICHTEXTITEM("Body")
                Call rtItem.APPENDTEXT(strMSG)
                Call rtItem.ADDNEWLINE(1)
                
                'Attach a document!
                
                'Call rtItem.embedobject(1454, "", Attachment)
                '' set all object handles to nothing to release memory
                Call Doc.send(False) 'Make sure this parameter stays false
                Set Doc = Nothing
                Set db = Nothing
                Set s = Nothing
                Set rtItem = Nothing
                
                MsgBox "Mail has been sent!", vbInformation
            
                Exit Sub
            ErrorLogon:
                If Err.Number = 7063 Then
                    MsgBox "Please login to Lotus Notes first!", vbCritical
                    Set Doc = Nothing
                    Set s = Nothing
                    Set rtItem = Nothing
                    
                    Exit Sub
                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 s = Nothing
                    Set rtItem = Nothing
                    Exit Sub
                End If
                    
            End Sub
            

            I have bolded an instruction above, is this the way to include an attachment?

          • #851890

            Hi Scott
            I have a client that needs to email via Lotus Notes. As part of the email process they need to send an attachment (PDF). Does your database example provide the answer. If not, can you or someone else help me.

          • #851891

            Hi Scott
            I have a client that needs to email via Lotus Notes. As part of the email process they need to send an attachment (PDF). Does your database example provide the answer. If not, can you or someone else help me.

            • #852051

              Pat here is the code to send 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 = (“email@address.com”) ‘the address you want to send to
              ‘SENDS A RETURN RECIEPT
              ‘doc.RETURNRECIEPT = “1”
              doc.Subject = “Type your subject line here”

              ‘ this will build the text part of your mail message

              Set rtItem = doc.CREATERICHTEXTITEM(“Body”)
              Call rtItem.APPENDTEXT(“Type the body of your email here”)
              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

            • #852342

              >>Call rtItem.EMBEDOBJECT(1454, “”, Attachment)<<

              Is Attachment a path and name of a file to send (eg c:dataearthlyPurchaseOrder.pdf)?

            • #852963

              Patt,
              The correct usage would be to call the function and supply the file location:
              SendLotus(“C:Your document.pdf”)

            • #852986

              Thanks for your help Scott

            • #852987

              Thanks for your help Scott

            • #852343

              >>Call rtItem.EMBEDOBJECT(1454, “”, Attachment)<<

              Is Attachment a path and name of a file to send (eg c:dataearthlyPurchaseOrder.pdf)?

            • #852052

              Pat here is the code to send 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 = (“email@address.com”) ‘the address you want to send to
              ‘SENDS A RETURN RECIEPT
              ‘doc.RETURNRECIEPT = “1”
              doc.Subject = “Type your subject line here”

              ‘ this will build the text part of your mail message

              Set rtItem = doc.CREATERICHTEXTITEM(“Body”)
              Call rtItem.APPENDTEXT(“Type the body of your email here”)
              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

            • #852417

              If you plan to do a lot of work automating Lotus Notes from Access/VBA, recommend take a look at this previous thread:

              Re: Mail via Lotus Notes (Access 2000/xp)

              This post has link to the IBM Lotus Notes site:

              Lotus Documentation – Domino and Notes Toolkit for COM Guide

              If you check this site, you’ll find a link to download the Notes Toolkit for COM Guide in compiled HTML (.CHM) help file format. In simple terms, “COM” (as in “COM Automation”) means that Lotus Notes can be automated using a COM-aware programming language such as VB/VBA. The guide provides code examples in both VB and VB Script, a description of the Domino/Notes object model, and much more useful information. If you intend to work further with Lotus Notes in VBA, recommend download this guide – don’t think your VBA “Help” files cover this stuff….

              HTH

            • #852477

              Thanks Scott, I will try this at the Client site it that’s ok with you.

              Thanks Mark, I am in for some reading but I have to learn this stuff.

            • #852478

              Thanks Scott, I will try this at the Client site it that’s ok with you.

              Thanks Mark, I am in for some reading but I have to learn this stuff.

            • #852418

              If you plan to do a lot of work automating Lotus Notes from Access/VBA, recommend take a look at this previous thread:

              Re: Mail via Lotus Notes (Access 2000/xp)

              This post has link to the IBM Lotus Notes site:

              Lotus Documentation – Domino and Notes Toolkit for COM Guide

              If you check this site, you’ll find a link to download the Notes Toolkit for COM Guide in compiled HTML (.CHM) help file format. In simple terms, “COM” (as in “COM Automation”) means that Lotus Notes can be automated using a COM-aware programming language such as VB/VBA. The guide provides code examples in both VB and VB Script, a description of the Domino/Notes object model, and much more useful information. If you intend to work further with Lotus Notes in VBA, recommend download this guide – don’t think your VBA “Help” files cover this stuff….

              HTH

    Viewing 0 reply threads
    Reply To: send lotus note email from listbox (a97)

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

    Your information: