By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,224 Members | 1,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,224 IT Pros & Developers. It's quick & easy.

how to send ASP newsletter to a select group from Access DB

P: n/a
i have an *access database + ASP newsletter* that is working fine and
it sends newsletter to ALL the email addresses in the DB.
i want to send this newsletter to only a select group (like people
with same name or same city etc). how do i do that?
here is the code of newsletter. where should i make changes?
Thanx in advance for ur help.
<%
' Declaring variables
Dim Subject,message,email,data_source,sql_select,no
no = 0
subject = Request.Form("subject") ' title of the newsletter
message = Request.Form("message") ' message of the newsletter

sql_select = "select email from database"
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _

Server.MapPath("database.mdb")

' Check to see if you have not pressed the 'send' button mistakenly
If Len(message) Then

Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql_select, data_source
While Not rs.EOF
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.From = "we*******@website.com"
mail.To = rs("email")
mail.Subject = subject
mail.Body = message
mail.Send
Set mail = Nothing
no = no + 1
rs.MoveNext
Wend
' When messages have been sent to all the users, exit
Response.Write "Thanks. Newsletter has been sent "

rs.Close
Set rs = Nothing
' Had you pressed the button mistakenly with text area empty, then
' redirect back to the HTML Form
Else
Response.Redirect "newsletter.asp"
End If
%>

i will be adding the following parameters for the selective
newsletter:

firnm = request.form("firstn") ' first name from the form
minm = request.form("midn") ' middle name from the form
lanm = request.form("lastn") ' last name from the form
joined = Request.form("batch") ' year from the form
sender = Request.form("email") ' email add of the person sending the
newsletter
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.