how to send ASP newsletter to a select group from

Results 1 to 2 of 2

Thread: how to send ASP newsletter to a select group from

  1. #1
    Join Date
    Dec 1969

    Default how to send ASP newsletter to a select group from

    i have an *access database + ASP newsletter* that is working fine and it sends newsletter to ALL the email addresses in the DB.<BR>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?<BR>here is the code of newsletter. where should i make changes and what changes? Thanx a zillion for ur help.<BR><BR><BR>&#060;%<BR>&#039; Declaring variables<BR>Dim Subject,message,email,data_source,sql_select,no<BR >no = 0<BR>subject = Request.Form("subject") &#039; title of the newsletter<BR>message = Request.Form("message") &#039; message of the newsletter<BR><BR>sql_select = "select email from database"<BR>data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _ <BR><BR> Server.MapPath("database.mdb")<BR><BR>&#039; Check to see if you have not pressed the &#039;send&#039; button mistakenly<BR>If Len(message) Then<BR><BR>Set rs = Server.CreateObject("ADODB.Recordset")<BR>rs.Open sql_select, data_source<BR>While Not rs.EOF<BR>Set mail = Server.CreateObject("CDONTS.NewMail")<BR>mail.From = ""<BR>mail.To = rs("email")<BR>mail.Subject = subject<BR>mail.Body = message<BR>mail.Send<BR>Set mail = Nothing<BR>no = no + 1<BR>rs.MoveNext<BR>Wend<BR>&#039; When messages have been sent to all the users, exit<BR>Response.Write "Thanks. Newsletter has been sent " <BR><BR>rs.Close<BR>Set rs = Nothing<BR>&#039; Had you pressed the button mistakenly with text area empty, then<BR>&#039; redirect back to the HTML Form<BR>Else<BR>Response.Redirect "newsletter.asp"<BR>End If<BR>%&#062;<BR><BR>i will be adding the following parameters for the selective<BR>newsletter:<BR><BR>firnm = request.form("firstn") &#039; first name from the form<BR>minm = request.form("midn") &#039; middle name from the form<BR>lanm = request.form("lastn") &#039; last name from the form<BR>joined = Request.form("batch") &#039; year from the form<BR>sender = Request.form("email") &#039; email add of the person sending the<BR>newsletter<BR>

  2. #2
    Join Date
    Dec 1969

    Default Change your SQL statement..

    sql_select = "select email from database" <BR><BR>To include the variables from your form.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts