Email Blast problem

Results 1 to 3 of 3

Thread: Email Blast problem

  1. #1
    Nibbi Guest

    Default Email Blast problem

    I have been trying to send an email blast to people that have requested it. I have a field in my table called "Notify" that is populated with either the word "Yes" or it is empty. For some reason, the email is going to everyone when it is run. Here is the code I am using. Is there something obvious wrong? Should I not leave the "Notify" field empty when they dont want email... should it say "No" instead?<BR><BR>Thanks in advance.<BR>Nibbi<BR><BR><BR>&#060;%<BR>set conn = server.createobject ("adodb.connection")<BR> "myDatabase"<BR>if not IsEmpty(Request.Form("Send")) then<BR> if Request.Form("SendTo") = "Requested" then<BR> set RSEmails = conn.Execute("select EmailAddress from Logins where Notify = yes ")<BR> end if<BR><BR> FromAddress = ""<BR> do Until RSEmails.eof<BR> set objMail = CreateObject("CDONTS.NewMail")<BR> objMail.Send FromAddress,RSEmails("EmailAddress"), _<BR> cstr(Request.Form("Subject")),cstr(Request.Form("M essage"))<BR> set objmail = nothing <BR> RSEmails.MoveNext<BR> loop<BR> <BR> TheMessage = "Message was sent!"<BR>else<BR> TheMessage = "Enter your message below"<BR>end if<BR><BR>%&#062;

  2. #2
    chris willey Guest

    Default RE: Email Blast problem

    Assuming the code you&#039re posting is verbatim, you need to put single quotes around the word &#039yes&#039 in your SELECT statement. That should fix the problem. Actually, I&#039m not sure why you&#039re not getting an error (something like "type mismatch"), since without the single quotes SQL is looking for a numeric field...anyway, give my suggestion a try.<BR><BR>Also, just a tip, I would recommend re-writing your do...loop block like this:<BR><BR>set objMail = CreateObject("CDONTS.NewMail")<BR>do Until RSEmails.eof<BR> objMail.Send FromAddress,RSEmails("EmailAddress"),_<BR> cstr(Request.Form("Subject")),cstr(Request.Form("M essage"))<BR>RSEmails.MoveNext<BR>loop<BR>setobjMa il = Nothing<BR><BR>If memory serves, this is legal, and will avoid creating and destroying a ton of objects on your server every time the script is run.<BR><BR>Good luck.

  3. #3
    Nibbi Guest

    Default RE: Email Blast problem

    Chris,<BR><BR>Thank you very much for your help.. I will use your suggestions today. <BR><BR>Not too sure why I didnt get an error message. Maybe the fact that I am using Access DB rather than SQL might have something to do with it.

Posting Permissions

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