Email to Multiple Recipients (1 Viewer)

GinaM

New member
Local time
Today, 06:44
Joined
Dec 30, 2009
Messages
2
The code below places a recipients email address into the BCC line and attaches an external txt file into the body of the email. It works great. My problem is that I have multiple recipients and because I can not bypass Outlook's security feature I will have to click Send for every email.

I would like all the email addresses to appear on the BCC line together. I have been researching the problem for a few days and I'm still not able to find the right code to add to my current code.

Anyone have any ideas? Suggestions?

Dim rsEmail As DAO.Recordset
Dim strBody As String
Dim strmystring As String, mynewstring As String

Open "e:\Stories.txt" For Input As #1
Do While Not EOF(1)
Line Input #1, mystring
mynewstring = mynewstring & vbCrLf & mystring
Loop
Close #1

Set rsEmail = CurrentDb.OpenRecordset("qEmail")
Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("Email").Value

DoCmd.SendObject , , , "myemailaddress@com", , strEmail, "Re: Test Subject", "Hello, " & vbCrLf & mynewstring

rsEmail.MoveNext
Loop
Set rsEmail = Nothing
End Sub
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 03:44
Joined
Aug 30, 2003
Messages
36,118
You'd move the SendObject below the loop, and within the loop build a string with the addresses:

strEmail = strEmail & rsEmail.Fields("Email").Value & ";"
 

GinaM

New member
Local time
Today, 06:44
Joined
Dec 30, 2009
Messages
2
Thanks Paul! Now I'm thinking of having the emails sent from our gmail account. If you have any suggestions they will be greatly appreciated!
 

Users who are viewing this thread

Top Bottom