Solved

lotus notes and vb

Posted on 2001-06-06
2
235 Views
Last Modified: 2010-05-02
I can email with attachment fine, but i need to send to multiple addresses. I dont know how to do this. If i comma seperate the addresses the second address gets corrupted somehow. Does anyone have any fast code on emailing to multiple addresses?
0
Comment
Question by:damion69
[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
2 Comments
 
LVL 1

Accepted Solution

by:
dkaygee earned 50 total points
ID: 6160397
Try this out: Essentially, you have to set up an array of users that you want to email.

Dim CntRecipients(1 To 3) As String
  CntRecipients(1) = "User 1@whatever.com"
  CntRecipients(2) = "User 2@whatever.com"
  CntRecipients(3) = "User 3@@whatever.com"
 
  Set Session = CreateObject("Notes.NotesSession")
 
  strUserName = Session.UserName
  Set db = Session.GETDATABASE("", "")

  If db.ISOPEN = True Then
  'Do nothing, mail is already open
  Else
 
  Call db.OPENMAIL
  End If
 
  Set doc = db.CREATEDOCUMENT()
  doc.Form = "Memo"
  doc.Subject = strSubject & " # " & strRequestNumber
  doc.Body = strBodyText
  doc.CopyTo = strCC
  'Blind Copies the User
  doc.BlindCopyTo = strUserName

  Call doc.SEND(False, CntRecipients)
 
  'Unload from memory
  Set Session = Nothing
  Set db = Nothing
  Set doc = Nothing

I also have created a Class module that essentially works
the same way:


Public Sub SendLotusNotesEMail(strBodyText As String, strSubject As String, _
                                strRecipients() As String, strCC As String)
  On Error GoTo Err

  Dim Session As Object
  'Dim Session As NOTESSESSION
  Dim db As Object
  'Dim db As NOTESDATABASE
  Dim doc As Object
  'Dim doc As notesdocument
  Dim strUserName As String
  Dim MailDbName As String
  Dim Test
 
  Set Session = CreateObject("Notes.NotesSession")
 'This Code will fail if Lotus Notes is open and the user is NOT logged in.
 'Error Message provided.
 
  strUserName = Session.UserName
 
  'Using Default Server,Database
  Set db = Session.GETDATABASE("", "")

  If db.ISOPEN = True Then
  'Do nothing, mail is already open
  Else
 
 
  Call db.OPENMAIL
  End If
 
  Set doc = db.CREATEDOCUMENT()
  doc.Form = "Memo"
  doc.Subject = strSubject
  doc.Body = strBodyText
  doc.CopyTo = strCC
  'Blind Copies the User
  doc.BlindCopyTo = strUserName
 
  'Call doc.Send(AttachForm(true/false),Recipients array)
  Call doc.SEND(False, strRecipients)
   
    'Unload from memory
    Set doc = Nothing
    Set Session = Nothing
    Set db = Nothing
Exit Sub
Err:
Select Case Err.Number
    Case 7063
    MsgBox "User Not Logged Into Lotus Notes", vbCritical
    MsgBox "Email Attempt Failed"
    Set doc = Nothing
    Set Session = Nothing
    Set db = Nothing
    Exit Sub
    Case Else
    Err.Raise vbObjectError + 1000, , "Lotus Notes Email Error"
End Select

End Sub

0
 
LVL 2

Author Comment

by:damion69
ID: 6160469
Thank you i have been toying around with this for way to long.
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

689 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