Hi
I have some code that takes from a query, an email address and sends out an email.
Due the security warning that happens for each individual email, i want to create ONE email for all email address in the query and populate them to the BCC section of the sendobject.
Here is the code that I currently use
I want to populate the BCC field with multiple emails addresses seperated by ":" and send just one email
Any help would be great
I have some code that takes from a query, an email address and sends out an email.
Due the security warning that happens for each individual email, i want to create ONE email for all email address in the query and populate them to the BCC section of the sendobject.
Here is the code that I currently use
Code:
Private Sub cmdSendEmail_Click()
Dim MyDB As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
Set MyDB = CurrentDb()
Set rsEmail = MyDB.OpenRecordset("SELECT * FROM qrySendEmails WHERE CourseID = " & CourseID & "")
With rsEmail
.MoveFirst
Do Until rsEmail.EOF
If IsNull(.Fields(11)) = False Then
sToName = "mycurrentworkemailaddress@somewhere.co.uk"
sBccName = .Fields(11) ' Email address of the recipient
sSubject = .Fields(1) & " " & .Fields(2)
sMessageBody = "Dear Delegate " & vbCrLf & _
vbCrLf & _
vbCrLf & _
"This email is confirmation of your place on the following course:" & _
vbCrLf & _
vbCrLf & _
"" & .Fields(1) & _
vbCrLf & _
"" & .Fields(2) & _
vbCrLf & _
"The course Trainer is: " & .Fields(3) & _
vbCrLf & _
vbCrLf & _
"The Course Venue is:" & _
vbCrLf & _
vbCrLf & _
"" & .Fields(5) + vbCrLf & _
"" & .Fields(6) + vbCrLf & _
"" & .Fields(7) + vbCrLf & _
"" & .Fields(8) + vbCrLf & _
"" & .Fields(9) + vbCrLf & _
"" & .Fields(10)
DoCmd.SendObject acSendNoObject, , , _
sToName, , sBccName, sSubject, sMessageBody, False, False
End If
.MoveNext
Loop
End With
Set MyDB = Nothing
Set rsEmail = Nothing
End Sub
I want to populate the BCC field with multiple emails addresses seperated by ":" and send just one email
Any help would be great