Using ASPEmail & a Database

Results 1 to 2 of 2

Thread: Using ASPEmail & a Database

  1. #1
    Join Date
    Dec 1969

    Default Using ASPEmail & a Database

    OK. I am going nuts.<BR><BR>I am trying to set up a simple script that will open the database, pull out the specified records, and send an email. <BR><BR>Ok, here&#039s my code:<BR><BR>Set MyConn = Server.CreateObject("ADODB.Connection")<BR> Set RS = Server.CreateObject("ADODB.Recordset")<BR> MyConn.Open "DSN=MyDSN"<BR> SQL="Select first, lastname, email, autonumber From main where year = 86 order by first"<BR> <BR><BR> If Request("Send") &#060;&#062; "" Then<BR> &#039 send email to all users<BR> Set Mail = Server.CreateObject("Persits.MailSender")<BR> Mail.Host = ""<BR> <BR> Mail.From = ""<BR> Mail.FromName = "Karen"<BR> Mail.Subject = Request("Subject")<BR> Mail.Body = Request("Body") & "rs(""autonumber"")"<BR><BR> &#039 read address from DB and put them in the BCC field<BR> While not rs.EOF<BR> Mail.AddBcc rs("email")<BR> rs.MoveNext<BR> Wend<BR><BR> &#039 finally: send message<BR> Mail.Send<BR><BR> Response.Write "Success!"<BR> Else<BR> &#039 simply display the list of users in the database<BR> Response.Write "&#060;B&#062;Currently in the user database:&#060;/B&#062;&#060;P&#062;"<BR> While not rs.EOF <BR><BR> Response.Write rs("first") & " (" & rs("email") & ")<BR>"<BR> rs.MoveNext<BR> Wend<BR> End If<BR>%&#062;<BR><BR>I know there is something not right with my connection string. <BR><BR>PLEASE HELP ME!<BR><BR>-Karen

  2. #2
    Boss Guest


    why do you need a connection object. All you need is a connection string. <BR><BR>Basically after your SQL formullation, you need to open the recordset using SQL<BR><BR>Cheers<BR>Boss<BR><BR>

Posting Permissions

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