Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending group email

Status
Not open for further replies.

jgarnick

Programmer
Feb 16, 2000
189
US
Is there a way to grab a bunch of selected email addresses from a table and send an email to all of them, BUT only have the receipient's email address displayed, not the whole group?<br><br>We have a &quot;directory&quot; in Access that has an email field and we need to be able to select which email addresses to send to and then use Outlook to send them--the emails will be press releases and we don't want the different newspapers to see who else we sent the email to-- <br><br>I know it would be easier to do it directly from Outlook but it's not an option here.&nbsp;&nbsp;The information has to come from out Access directory.<br><br>Thanks!! <p>jgarnick<br><a href=mailto:jgarnick@aol.com>jgarnick@aol.com</a><br><a href= > </a><br>
 
Is out look installed on the mcahine where the e-mail will originate?<br><br>then use docmd.sendobject<br>You need to return a recordset of your e-mails somehow<br>Then just loop through the recordset<br><br>I would add a &quot;Yes/NO&quot; field to your table that you check if you want to send to a &quot;bunch&quot; of people.<br>Then this code will send a e-mail to everyone you check.<br>-----------------------------------------<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim db As Database, rst As Recordset, SQL As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim a As Integer, EmailInfo As String<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;Set db = CurrentDb<br>&nbsp;&nbsp;&nbsp;&nbsp;SQL = &quot;Select * From Contacts Where EmailMe = True;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;Set rst = db.OpenRecordset(SQL)<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.MoveLast<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.MoveFirst<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;For a = 1 To rst.RecordCount<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' Infomation could also change here<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EmailInfo = &quot;Dear &quot; & Me![FirstName] & Chr$(10) & Chr$(13)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EmailInfo = &quot;Blah Blah More stuff&quot; & Chr$(10) & Chr$(13)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EmailInfo = EmailInfo & &quot;&quot; & Chr$(10) & Chr$(13)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EmailInfo = EmailInfo & &quot;Thanks Doug&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.SendObject acSendNoObject, &quot;&quot;, acFormatTXT, rst!Email, , , &quot; &quot;, EmailInfo, False<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rst.MoveNext<br>&nbsp;&nbsp;&nbsp;&nbsp;Next<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;rst.Close<br>&nbsp;&nbsp;&nbsp;&nbsp;db.Close<br>------------------------------------------<br>NOW this sends an e-mail to everyone in the list whose name is checked not to a group as you mentioned.<br>So if there are 25 people it will generate 25 separate e-mails.<br>So everyones name would not show at the top (or in the sent to:) Only the persons e-mail that it is intended for.<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
If you are out there DougP, I need more help--I haven't used the Sendobject command in Access yet.<br><br>I believe the problem may be the rst!email part of the docmd.sendobject statement.&nbsp;&nbsp;The program bombs out and gives me a &quot;Item not found in this collection.&quot; error message.<br><br>I guess I am also confused how the body of the email gets created?&nbsp;&nbsp;Should the user type it in a form?&nbsp;&nbsp;Can you send an attachment to the email?&nbsp;&nbsp;I guess I am missing something.<br><br>I don't have an &quot;email&quot; --as in the body of a email-- field, just an email address field.<br><br>Thanks for your help so far! <p>jgarnick<br><a href=mailto:jgarnick@aol.com>jgarnick@aol.com</a><br><a href= > </a><br>
 
The body of the e-mail can be an Access object such as a report or query. Which would go in place of the acSendNoObject,&quot;&quot;<br>What do you want to send to those people?<br>To find out about &quot;Sendobject&quot;...<br>Do this Type &quot;docmd.sen&quot; and then hit the space bar it will put Sendobject in then show a list of possible objects to send. You can then use your mouse to pick one. Then it wants to know its name which you will have to go find. It will also help you fill in the rest of it after each Comma a new thing will show.<br>Also if you just type docmd.Sendobject and stop then double click on the word Sendobject and press F1 it will bring up help and explain each paramter.<br><br>As far as the &quot;rst!email&quot; goes you need to change &quot;email&quot; to the correct spelling of your e-mail field in your database. Your original post said &quot;We have a &quot;directory&quot; in Access that has an email field&quot;. What is the name of your e-mail field?<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top