Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

lotus notes and vb

Posted on 2001-06-06
2
Medium Priority
?
244 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
2 Comments
 
LVL 1

Accepted Solution

by:
dkaygee earned 200 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

877 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