Send email with Lotus Notes to an email group.

pandis05

Board Regular
Joined
Jul 20, 2004
Messages
58
Hi all,

Not to confuse this question to just sending emails to multiple people, what I'm trying to do is send an email to a predefined group within Lotus Notes. The code I'm using currently is below.

Within Lotus Notes i've create a group called 'test' which contains 2 email addresses, now I want to address the email to 'test' and not have to know the individuals email addresses as the group will change constantly.

I've read pretty much all of the past emails and I can't seem to find an answer to this question.

Any suggestions would be greatly appreciated.


Code:
Sub NotsCoreCode()
            
    With Application
        .ScreenUpdating = False
        .DisplayAlerts = False
    End With
    
  ' Declare Variables for file and macro setup

    Dim UserName As String
    Dim MailDbName As String
    Dim Maildb As Object
    Dim MailDoc As Object
    Dim AttachME As Object
    Dim Session As Object
    Dim EmbedObj1 As Object

  ' Open and locate current LOTUS NOTES User

    Set Session = CreateObject("Notes.NotesSession")
        UserName = Session.UserName
    MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
    Set Maildb = Session.GETDATABASE("", MailDbName)
    If Maildb.IsOpen = True Then
    Else
        Maildb.OPENMAIL
    End If

  ' Create New Mail and Address Title Handlers

    Set MailDoc = Maildb.CreateDocument

    MailDoc.Form = "Memo"
    '   Select range of e-mail addresses
    recipient = "andrew.matthews"
    MailDoc.SendTo = recipient
    
    'ans = MsgBox("Would you like to Copy (cc) anyone on this message?" _
    '    , vbQuestion & vbYesNo, "Send Copy")
    '
    '    If ans = vbYes Then
    '        ccRecipient = InputBox("Please enter the additional recipient's e-mail address" _
    '            , "Input e-mail address")
    '        MailDoc.CopyTo = ccRecipient
    '    End If
            
    MailDoc.Subject = "CSB daily DOH"
        MailDoc.Body = _
    "Attached is a update of Documents on Hand within CSB."

'   Select Workbook to Attach to E-Mail

    MailDoc.SaveMessageOnSend = True
        Attachment1 = "C:\CSB DOH.xls" '    Required File Name

    If Attachment1 <> "" Then
        On Error Resume Next
            Set AttachME = MailDoc.CREATERICHTEXTITEM("attachment1")
            Set EmbedObj1 = AttachME.embedobject(1454, "attachment1", "C:\CSB DOH.xls", "") 'Required File Name
        On Error Resume Next
    End If

    MailDoc.PostedDate = Now()
        On Error GoTo errorhandler1
    MailDoc.Send 0, recipient

    Set Maildb = Nothing
        Set MailDoc = Nothing
            Set AttachME = Nothing
        Set Session = Nothing
    Set EmbedObj1 = Nothing

errorhandler1:
MsgBox ("error")
    Set Maildb = Nothing
        Set MailDoc = Nothing
            Set AttachME = Nothing
        Set Session = Nothing
    Set EmbedObj1 = Nothing

    With Application
        .ScreenUpdating = True
        .DisplayAlerts = True
    End With
    
End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,207,260
Messages
6,077,352
Members
446,279
Latest member
hoangquan2310

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top