<%
Option Explicit
Dim conn
Dim RSCategories
Dim RSCustomers
Dim ObjMail
set conn = server.createobject ("adodb.connection")
conn.open "ASPBook", "sa", "nep2tune"
If not IsEmpty(Request.Form("Send")) Then
  set RSCustomers = conn.execute("select EmailAddress from " _
    & "ASPCustomerWithCategory where Category = '" _
    & Request.Form("Category") & "'")
  Do Until RSCustomers.EOF
    Set objMail = CreateObject("CDONTS.NewMail")
    objMail.Send Request.Form("FromEmailAddress"), _
      RSCustomers("EmailAddress"), Request.Form("Subject"), _
      Request.Form("Message")
    Set objMail = Nothing
    RSCustomers.MoveNext
  Loop   
End If
set RSCategories = conn.execute("select CategoryName from ASPCategories " _
  & "order by CategoryName")
%>
