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

C

cooldv

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 = "(e-mail address removed)"
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top