I was wondering if can anyone tell me how can I send email to group of people (based on some criteria) using VB or VBA.
Let say I have a form which brings in some information and the name of people and their email address, and then I have a button called send. What I want is, when I click on the button "send" I want to be able to send email to those selected peoples.
Please help
Tara
hi
ceate a listbox in your Form with recipient addresses from which to chose
make sure to enable multisect (here lstAddress)
put MapiSession and MapiMessage in your Form (here mapSession and mapMsg)
and try this sample
[code]
With mapSession
.DownLoadMail = False
.LogonUI = True
.SignOn
.NewSession = True
mapMsg.SessionID = .SessionID
End With
With mapMsg
.Compose
For i = 0 To lstAddress.ListCount - 1
If lstAddress.Selected(i) = True Then
If .RecipAddress = vbNullString Then
.RecipAddress = lstAddress.List(i)
Else
.RecipAddress = .RecipAddress & "; " & lstAddress.List(i)
End If
End If
Next i
.MsgIndex = -1
.MsgSubject = "SUBJECT" 'subject
.AttachmentPathName = AttFileName 'filename to assign
.MsgNoteText = MSG 'message
End If
.Send True
End With
mapSession.SignOff
[code]