fvillena
09-30-2003, 09:36 AM
Hi Everyone
I have a page that sends an email of database driven content to a subsription list which is also taken from a database.
The problem is that after the first email is sent, the message duplicates itself each time it goes through the loop, so the second email address on the list receives the message twice, the third person three times and so on.
Any help would be greatly appreciated, below is the code
<%
Dim SQL, rsNewsletter
SQL = "SELECT * FROM tblnewsletters "
SQL = SQL & "WHERE idissue = " & idissue
set rsNewsletter = conn.execute(SQL)
if not rsNewsLetter.eof then
vDescription = rsNewsletter("chrdescription")
vNewstitle = rsNewsletter("chrtitle")
vNewsfile = rsNewsletter("chrfile")
End if
rsNewsLetter.close
Dim rsSubscribe
SQL = "SELECT * FROM tblezine"
SQL = SQL & " ORDER BY chremail"
Set rsSubscribe = conn.execute(SQL)
Do Until rsSubscribe.EOF
'Send Newsletter
Dim MyCDONTSMail2
Dim HTML
Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
HTML = HTML & "<html>"
HTML = HTML & "<body>"
HTML = HTML & "<link href=""http://westwood.users19.donhost.co.uk/westwood.css"" rel=""stylesheet"" type=""text/css""> "
HTML = HTML & "<table width=""750"" border=""0"" cellpadding=""5"" cellspacing=""0"" class=""mainbar"">"
HTML = HTML & "<tr>"
HTML = HTML & "<td><p class=""titles""><img src=""http://westwood.users19.donhost.co.uk/img/logo_4.gif"" align=""right"">Westwood Club: " & vNewsTitle & "</p>"
IF vNewsFile <> "" THEN
HTML = HTML & "<p><a href=""http://westwood.users19.donhost.co.uk/pdf/" & vNewsfile & " "">Click here to be taken to the newsletter</a> (Requires Acrobat Reader)</p>"
END IF
HTML = HTML & "<p>" & replace(vDescription,vbcrlf,"<BR>") & "</p>"
HTML = HTML & "<p><a href=""http://westwood.users19.donhost.co.uk/index.asp"">Click here to be taken to our website</a></p>"
HTML = HTML & "<p><a href=""http://westwood.users19.donhost.co.uk/unsubscribe.asp?idezine=" & rsSubscribe("idezine") & "&chremail=" & rsSubscribe("chremail") & """>Click here to unsubscribe to this newsletter</a></p>"
HTML = HTML & "West Wood Club | Clontarf Rd | Dublin 3 | <br>"
HTML = HTML & "Tel: +353 1 222 2222 | Fax: +353 1 222 2222<br> © West Wood Fitness"
HTML = HTML & "Club 2003. All Rights Reserved.</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
MyCDONTSMail2.From= "info@westwood.ie"
MyCDONTSMail2.To= rsSubscribe("chremail")
MyCDONTSMail2.Subject="Westwood Club: " & vNewstitle
MyCDONTSMail2.BodyFormat=0
MyCDONTSMail2.MailFormat=0
MyCDONTSMail2.Body=HTML
MyCDONTSMail2.Send
set MyCDONTSMail2=nothing
rsSubscribe.MoveNext
Loop
rsSubscribe.Close
%>
I have a page that sends an email of database driven content to a subsription list which is also taken from a database.
The problem is that after the first email is sent, the message duplicates itself each time it goes through the loop, so the second email address on the list receives the message twice, the third person three times and so on.
Any help would be greatly appreciated, below is the code
<%
Dim SQL, rsNewsletter
SQL = "SELECT * FROM tblnewsletters "
SQL = SQL & "WHERE idissue = " & idissue
set rsNewsletter = conn.execute(SQL)
if not rsNewsLetter.eof then
vDescription = rsNewsletter("chrdescription")
vNewstitle = rsNewsletter("chrtitle")
vNewsfile = rsNewsletter("chrfile")
End if
rsNewsLetter.close
Dim rsSubscribe
SQL = "SELECT * FROM tblezine"
SQL = SQL & " ORDER BY chremail"
Set rsSubscribe = conn.execute(SQL)
Do Until rsSubscribe.EOF
'Send Newsletter
Dim MyCDONTSMail2
Dim HTML
Set MyCDONTSMail2 = CreateObject("CDONTS.NewMail")
HTML = HTML & "<html>"
HTML = HTML & "<body>"
HTML = HTML & "<link href=""http://westwood.users19.donhost.co.uk/westwood.css"" rel=""stylesheet"" type=""text/css""> "
HTML = HTML & "<table width=""750"" border=""0"" cellpadding=""5"" cellspacing=""0"" class=""mainbar"">"
HTML = HTML & "<tr>"
HTML = HTML & "<td><p class=""titles""><img src=""http://westwood.users19.donhost.co.uk/img/logo_4.gif"" align=""right"">Westwood Club: " & vNewsTitle & "</p>"
IF vNewsFile <> "" THEN
HTML = HTML & "<p><a href=""http://westwood.users19.donhost.co.uk/pdf/" & vNewsfile & " "">Click here to be taken to the newsletter</a> (Requires Acrobat Reader)</p>"
END IF
HTML = HTML & "<p>" & replace(vDescription,vbcrlf,"<BR>") & "</p>"
HTML = HTML & "<p><a href=""http://westwood.users19.donhost.co.uk/index.asp"">Click here to be taken to our website</a></p>"
HTML = HTML & "<p><a href=""http://westwood.users19.donhost.co.uk/unsubscribe.asp?idezine=" & rsSubscribe("idezine") & "&chremail=" & rsSubscribe("chremail") & """>Click here to unsubscribe to this newsletter</a></p>"
HTML = HTML & "West Wood Club | Clontarf Rd | Dublin 3 | <br>"
HTML = HTML & "Tel: +353 1 222 2222 | Fax: +353 1 222 2222<br> © West Wood Fitness"
HTML = HTML & "Club 2003. All Rights Reserved.</td>"
HTML = HTML & "</tr>"
HTML = HTML & "</table>"
HTML = HTML & "</body>"
HTML = HTML & "</html>"
MyCDONTSMail2.From= "info@westwood.ie"
MyCDONTSMail2.To= rsSubscribe("chremail")
MyCDONTSMail2.Subject="Westwood Club: " & vNewstitle
MyCDONTSMail2.BodyFormat=0
MyCDONTSMail2.MailFormat=0
MyCDONTSMail2.Body=HTML
MyCDONTSMail2.Send
set MyCDONTSMail2=nothing
rsSubscribe.MoveNext
Loop
rsSubscribe.Close
%>