sending email

  • Thread starter Thread starter stella
  • Start date Start date
S

stella

Guest
Here is my code,

rst.MoveFirst
Do Until rst.EOF
.RECIPIENTS.Add rst!
rst.MoveNext
Loop
.DISPLAY

I would like to send an email to everybody in my access table, however, I would like to hide their email address from everybody else which means I will have to put their addresses on bcc
My problem is I can not put everybody's address in bcc box using a Do loop.


Thank you in advance
 
Couldn't you send the email to each recipient one time, instead of sending it to them via the same message? Most mailing lists operate in this fashion because a lot of ISP's see multiple recipient message as spam or junk mail and won't deliver them anyway. Other advantages to going this route are that you can personalize the message bodies (i.e. add their names at the beginning, "Hello John Doe,") and attachments if needed.

The SendObject command does support the BCC field, however, and can be used (see the Access help on SendObject for additional info):

DoCmd.SendObject [objecttype][, objectname][, outputformat][, to][, cc][, bcc][, subject][, messagetext][, editmessage][, templatefile]


There was a good post a while back on email on these boards as well:
http://www.access-programmers.co.uk/ubb/Forum7/HTML/001574.html
 
This should do it for you:

Dim rsEmail As DAO.Recordset
Dim strEmail As String
Set rsEmail = CurrentDb.OpenRecordset("YourQuery")

Do While Not rsEmail.EOF
strEmail = rsEmail.Fields("EmailAddress").Value
DoCmd.SendObject , , , strEmail, , , "Subject", "Message Text"

rsEmail.MoveNext

Loop
Set rsEmail = Nothing

"YourQuery" = Table or Query Name.
"EmailAddress" = Field in Table or Query holding the email address.

This will loop through an entire table or query sending an email to everyone in it.
 

Users who are viewing this thread

Back
Top Bottom