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

Discussion in 'ASP General' started by cooldv, Jul 12, 2003.

  1. cooldv

    cooldv Guest

    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 = ""
    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
    cooldv, Jul 12, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Sm9l?=

    Mailer, Newsletter script in asp/asp.net

    =?Utf-8?B?Sm9l?=, Feb 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    887
    Juan T. Llibre
    Feb 23, 2005
  2. Akaketwa
    Replies:
    1
    Views:
    4,832
    impaler
    Sep 22, 2006
  3. Replies:
    0
    Views:
    503
  4. christopher taylor
    Replies:
    0
    Views:
    394
    christopher taylor
    Sep 17, 2008
  5. palmiere
    Replies:
    1
    Views:
    382
    Erwin Moller
    Feb 9, 2004
Loading...

Share This Page