473,699 Members | 2,790 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending CDONTS HTML email issue

I have a web form where a client can select which site members to send
an email to.

This form is populated from the contents of the member table, so the
form can have 0-x names listed on it depending on member expiration dates.

When the form is submitted, the code loops through the form contents and
sends an email to those members that meet the selected criteria.

All this worked perfectly when I was sending text emails, but since I
changed, it sends the message correctly, but the last person gets
everyone else as well. For example, if I have three members (mem1, mem2
and mem3) to send emails to, here is what happens

mem1 gets the correctly formatted message

mem2 gets mem1's correctly formatted message plus mem2's message - one
right after the other.

mem3 gets mem1's correctly formated message, mem2's correctly formatted
message and mem3's message - one right after the other.

I'm not talking separate emails here, mem3 for example gets the body
content 3 times in one message, all correct for each member.

Here is the code, sorry it is long, but I didn't want to leave anything
out. I literally just swapped the plain text code for the HTML code and
added the necessary code in the send portion to send HTML rather than
plain text. I didn't change the logic at all.

Thanks

Brett

************** Code *************** ********

<%@LANGUAGE="VB SCRIPT" CODEPAGE="1252" %>
<%
on error resume next

iCount = Request.form("i Count")
iCount = iCount - 1

Set Conn = Server.CreateOb ject("ADODB.Con nection")
conn.open "DSN=XXXXXXXXXX XX"

'Now, we want to loop through each form element

Dim iLoop
For iLoop = 0 to iCount

'Request form elements

mem_first = request.form(iL oop & ".mem_first ")
mem_email = request.form(iL oop & ".mem_email ")
email_action = request.form(iL oop & ".email_action" )

'Send reminder email

If email_action = "reminder" then

MailBody = MailBody & "<html>" & vbCrlf & ""
MailBody = MailBody & "<body bgcolor=" & Chr(34) & "#FFCC66" & Chr(34) &
" text=" & Chr(34) & "#000000" & Chr(34) & " link=" & Chr(34) &
"#0033FF" & Chr(34) & " vlink=" & Chr(34) & "#0033FF" & Chr(34) & "
alink=" & Chr(34) & "#FF9900" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<p>&nbsp;</p>" & vbCrlf & ""
MailBody = MailBody & "<table width=" & Chr(34) & "600" & Chr(34) & "
border=" & Chr(34) & "3" & Chr(34) & " align=" & Chr(34) & "center" &
Chr(34) & " cellpadding=" & Chr(34) & "25" & Chr(34) & " cellspacing=" &
Chr(34) & "0" & Chr(34) & " bordercolor=" & Chr(34) & "#FF6600" &
Chr(34) & " bgcolor=" & Chr(34) & "#FFFFFF" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<tr>" & vbCrlf & ""
MailBody = MailBody & "<td valign=" & Chr(34) & "top" & Chr(34) & ">" &
vbCrlf & ""
MailBody = MailBody & "<p align=" & Chr(34) & "center" & Chr(34) &
"><b><font color=" & Chr(34) & "#FF6600" & Chr(34) & " size=" & Chr(34)
& "5" & Chr(34) & " face=" & Chr(34) & "Verdana, Arial, Helvetica,
sans-serif" & Chr(34) & ">Powerquot es Plus</font></b></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">From the desk of Kevin Eikenberry:</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Your <strong>Powerqu otes Plus</strong> membership will expire in one
week and I don’t want to lose you! </font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">With only one week left, I want to make sure you have plenty of time
to <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">renew your membership</a></strong> so you don’t miss
even one day of motivation and inspiration in your inbox.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">I’m sure if you spent some time looking through the private
membership site, worked through the questions, and applied all these
tools to your life, you’ll agree with me that this service is
filled with some incredible resources.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">They can give your entire day a new outlook and some great actions to
take – right?</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">We are now offering recurring billing so you can pay a very small
investment each month to get this powerful information. For only .95 a
month, less than the price of a couple cups of coffee at Starbucks you
can have hundreds of dollars worth of information and help.</font></p>"
& vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Or you can save 21% by paying just for the full year.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Get this… you will also get two weeks free for renewing to
<strong>Powerqu otes Plus</strong>! After 2 weeks it is a miniscule
amount to have a personal coach at your beck-and-call.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> I value you as a member.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">And I am willing to send you some free gifts just for <strong><a
href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">renewing your membership right
away</a></strong>.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">What are they?</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Three Special Reports:</font></p>" & vbCrlf & ""
MailBody = MailBody & "<ul>" & vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong><em>2 5 Great Quotations for your Personal
Success</em></strong></font></li>" & vbCrlf & ""
MailBody = MailBody & "<li><em><f ont size=" & Chr(34) & "2" & Chr(34) &
" face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong>2 5 Powerful Quotations for your Professional
Success</strong></font></em><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> – keep them at your side – or at your desk.</font></li>"
& vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong><em>2 5 Great Quotations to Help Others Succeed</em></strong>.
We all know that the more we help others, the more we achieve ourselves.
This is the perfect tool to help those around you life lives full of
abundance and joy.</font></li>" & vbCrlf & ""
MailBody = MailBody & "</ul>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">One last mega success bribe/bonus for your free
trial…</font></p>" & vbCrlf & ""
MailBody = MailBody & "<ul>" & vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> An audio of live keynote speech entitled <strong><em>Unl eashing Your
Potential in 2005</em></strong>. Groups pay up to 00 for my keynote
speeches and here is one for you for fr’ee. This keynote provides
ideas, tools and techniques to help you reach your personal and
professional goals in 2005. Along with rock solid techniques on goal
setting, I will share specific ideas to set you up for your best year
ever.</font></li>" & vbCrlf & ""
MailBody = MailBody & "</ul>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Hopefully , the promise here is quite simple: <strong><a href=" &
Chr(34) & "http://www.powerquotes plus.net/renew_1.asp?mem _email=" &
mem_email & Chr(34) & ">Renew your membership today to Powerquotes
Plus</a></strong> and I will send you all of the free reports, along
with the live keynote recording.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">It’s easy to renew. <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">All you have to do is click on this private
link</a></strong> and you will automatically renew your membership
(starting with the 2 week no charge additional bonus) and the
“bribes” will be sent out to you right away.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">I look forward to doing my part to help you be more
successful!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><img src=" & Chr(34) &
"http://www.powerquotes plus.net/images/kev_signature.j pg" & Chr(34) & "
width=" & Chr(34) & "53" & Chr(34) & " height=" & Chr(34) & "58" &
Chr(34) & "></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Kevin Eikenberry<br>< b>Powerquotes Plus</b> Founder</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">p.s. <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">Renew your membership today</a></strong> and receive all the
special bonus reports, audio and complimentary two weeks. Please put
some serious thought into what it is you are willing to do to make your
future a success. The tools you receive, and the membership benefits you
get, will help you accomplish whatever you want… on your own
terms.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> p.s.s. These additional bonuses/bribes are not available to the
public – only valuable members like you! <strong><a href=" &
Chr(34) & "http://www.powerquotes plus.net/renew_1.asp?mem _email=" &
mem_email & Chr(34) & ">Renew today</a></strong> and, at the least, you
can walk away with some tools you will not find anywhere else on the
net!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> p.s.s.s. Remember just one more week!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<hr width=" & Chr(34) & "95%" & Chr(34) & "
size=" & Chr(34) & "1" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "1" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">If you would like your name removed from future <strong>Powerqu otes
Plus</strong> mailings, please send an email to <strong><a href=" &
Chr(34) & "mailto:se***** @powerquotesplu s.net?Subject=R emove from PQ+
Mailings" & Chr(34) & ">se*****@power quotesplus.net</a></strong> with
your request.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "1" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">You were sent this email because you are a member of
<strong>Powerqu otes Plus</strong> using the following email: " &
mem_email & "</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p align=" & Chr(34) & "center" & Chr(34) &
"><font size=" & Chr(34) & "1" & Chr(34) & " face=" & Chr(34) &
"Verdana, Arial, Helvetica, sans-serif" & Chr(34) & ">(Pay member
reminder email)</font></p>" & vbCrlf & ""
MailBody = MailBody & "</td>" & vbCrlf & ""
MailBody = MailBody & "</tr>" & vbCrlf & ""
MailBody = MailBody & "</table>" & vbCrlf & ""
MailBody = MailBody & "</body>" & vbCrlf & ""
MailBody = MailBody & "</html>"

Dim objMsg
Set objMsg = Server.CreateOb ject("CDONTS.Ne wMail")
objMsg.From = "ke***@powerquo tesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyForm at = 0
objMsg.MailForm at = 0
objMsg.Send

Set objMsg = nothing

' update database

SQLstmt = "UPDATE tbl_pqplus_memb ers SET "
SQLStmt = SQLstmt & "action_status= '" & email_action & "'"
SQLStmt = SQLStmt & " WHERE mem_email='" & mem_email & "'"

Set RS = Conn.Execute(SQ LStmt)

If err.number>0 then
response.write "VBScript Errors Occured:" & "<P>"
response.write "Error Number=" & err.number & "<P>"
response.write "Error Descr.=" & err.description & "<P>"
response.write "Help Context=" & err.helpcontext & "<P>"
response.write "Help Path=" & err.helppath & "<P>"
response.write "Native Error=" & err.nativeerror & "<P>"
response.write "Source=" & err.source & "<P>"
response.write "SQLState=" & err.sqlstate & "<P>"
end if
IF conn.errors.cou nt> 0 then
response.write "Database Errors Occured" & "<P>"
response.write SQLstmt & "<P>"
for counter= 0 to conn.errors.cou nt
response.write "Error #" & conn.errors(cou nter).number & "<P>"
response.write "Error desc. -> " & conn.errors(cou nter).descripti on & "<P>"
next
else
end if

end if

'end reminder email

next

rs.close
set rs=nothing
Conn.Close
set conn=nothing

Response.Redire ct ("subscribers.a sp")

%>
Jul 22 '05 #1
5 2632
You likely forgot to clear the string that contains the HTML code for each
message...

Patrice

--

"BaWork" <ba****@sprynet .com> a écrit dans le message de
news:O7******** ******@TK2MSFTN GP15.phx.gbl...
I have a web form where a client can select which site members to send
an email to.

This form is populated from the contents of the member table, so the
form can have 0-x names listed on it depending on member expiration dates.

When the form is submitted, the code loops through the form contents and
sends an email to those members that meet the selected criteria.

All this worked perfectly when I was sending text emails, but since I
changed, it sends the message correctly, but the last person gets
everyone else as well. For example, if I have three members (mem1, mem2
and mem3) to send emails to, here is what happens

mem1 gets the correctly formatted message

mem2 gets mem1's correctly formatted message plus mem2's message - one
right after the other.

mem3 gets mem1's correctly formated message, mem2's correctly formatted
message and mem3's message - one right after the other.

I'm not talking separate emails here, mem3 for example gets the body
content 3 times in one message, all correct for each member.

Here is the code, sorry it is long, but I didn't want to leave anything
out. I literally just swapped the plain text code for the HTML code and
added the necessary code in the send portion to send HTML rather than
plain text. I didn't change the logic at all.

Thanks

Brett

************** Code *************** ********

<%@LANGUAGE="VB SCRIPT" CODEPAGE="1252" %>
<%
on error resume next

iCount = Request.form("i Count")
iCount = iCount - 1

Set Conn = Server.CreateOb ject("ADODB.Con nection")
conn.open "DSN=XXXXXXXXXX XX"

'Now, we want to loop through each form element

Dim iLoop
For iLoop = 0 to iCount

'Request form elements

mem_first = request.form(iL oop & ".mem_first ")
mem_email = request.form(iL oop & ".mem_email ")
email_action = request.form(iL oop & ".email_action" )

'Send reminder email

If email_action = "reminder" then

MailBody = MailBody & "<html>" & vbCrlf & ""
MailBody = MailBody & "<body bgcolor=" & Chr(34) & "#FFCC66" & Chr(34) &
" text=" & Chr(34) & "#000000" & Chr(34) & " link=" & Chr(34) &
"#0033FF" & Chr(34) & " vlink=" & Chr(34) & "#0033FF" & Chr(34) & "
alink=" & Chr(34) & "#FF9900" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<p>&nbsp;</p>" & vbCrlf & ""
MailBody = MailBody & "<table width=" & Chr(34) & "600" & Chr(34) & "
border=" & Chr(34) & "3" & Chr(34) & " align=" & Chr(34) & "center" &
Chr(34) & " cellpadding=" & Chr(34) & "25" & Chr(34) & " cellspacing=" &
Chr(34) & "0" & Chr(34) & " bordercolor=" & Chr(34) & "#FF6600" &
Chr(34) & " bgcolor=" & Chr(34) & "#FFFFFF" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<tr>" & vbCrlf & ""
MailBody = MailBody & "<td valign=" & Chr(34) & "top" & Chr(34) & ">" &
vbCrlf & ""
MailBody = MailBody & "<p align=" & Chr(34) & "center" & Chr(34) &
"><b><font color=" & Chr(34) & "#FF6600" & Chr(34) & " size=" & Chr(34)
& "5" & Chr(34) & " face=" & Chr(34) & "Verdana, Arial, Helvetica,
sans-serif" & Chr(34) & ">Powerquot es Plus</font></b></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">From the desk of Kevin Eikenberry:</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Your <strong>Powerqu otes Plus</strong> membership will expire in one
week and I don’t want to lose you! </font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">With only one week left, I want to make sure you have plenty of time
to <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">renew your membership</a></strong> so you don’t miss
even one day of motivation and inspiration in your inbox.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">I’m sure if you spent some time looking through the private
membership site, worked through the questions, and applied all these
tools to your life, you’ll agree with me that this service is
filled with some incredible resources.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">They can give your entire day a new outlook and some great actions to
take – right?</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">We are now offering recurring billing so you can pay a very small
investment each month to get this powerful information. For only .95 a
month, less than the price of a couple cups of coffee at Starbucks you
can have hundreds of dollars worth of information and help.</font></p>"
& vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Or you can save 21% by paying just for the full year.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Get this… you will also get two weeks free for renewing to
<strong>Powerqu otes Plus</strong>! After 2 weeks it is a miniscule
amount to have a personal coach at your beck-and-call.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> I value you as a member.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">And I am willing to send you some free gifts just for <strong><a
href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">renewing your membership right
away</a></strong>.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">What are they?</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Three Special Reports:</font></p>" & vbCrlf & ""
MailBody = MailBody & "<ul>" & vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong><em>2 5 Great Quotations for your Personal
Success</em></strong></font></li>" & vbCrlf & ""
MailBody = MailBody & "<li><em><f ont size=" & Chr(34) & "2" & Chr(34) &
" face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong>2 5 Powerful Quotations for your Professional
Success</strong></font></em><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> – keep them at your side – or at your desk.</font></li>"
& vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong><em>2 5 Great Quotations to Help Others Succeed</em></strong>.
We all know that the more we help others, the more we achieve ourselves.
This is the perfect tool to help those around you life lives full of
abundance and joy.</font></li>" & vbCrlf & ""
MailBody = MailBody & "</ul>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">One last mega success bribe/bonus for your free
trial…</font></p>" & vbCrlf & ""
MailBody = MailBody & "<ul>" & vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> An audio of live keynote speech entitled <strong><em>Unl eashing Your
Potential in 2005</em></strong>. Groups pay up to 00 for my keynote
speeches and here is one for you for fr’ee. This keynote provides
ideas, tools and techniques to help you reach your personal and
professional goals in 2005. Along with rock solid techniques on goal
setting, I will share specific ideas to set you up for your best year
ever.</font></li>" & vbCrlf & ""
MailBody = MailBody & "</ul>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Hopefully , the promise here is quite simple: <strong><a href=" &
Chr(34) & "http://www.powerquotes plus.net/renew_1.asp?mem _email=" &
mem_email & Chr(34) & ">Renew your membership today to Powerquotes
Plus</a></strong> and I will send you all of the free reports, along
with the live keynote recording.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">It’s easy to renew. <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">All you have to do is click on this private
link</a></strong> and you will automatically renew your membership
(starting with the 2 week no charge additional bonus) and the
“bribes” will be sent out to you right away.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">I look forward to doing my part to help you be more
successful!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><img src=" & Chr(34) &
"http://www.powerquotes plus.net/images/kev_signature.j pg" & Chr(34) & "
width=" & Chr(34) & "53" & Chr(34) & " height=" & Chr(34) & "58" &
Chr(34) & "></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Kevin Eikenberry<br>< b>Powerquotes Plus</b> Founder</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">p.s. <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">Renew your membership today</a></strong> and receive all the
special bonus reports, audio and complimentary two weeks. Please put
some serious thought into what it is you are willing to do to make your
future a success. The tools you receive, and the membership benefits you
get, will help you accomplish whatever you want… on your own
terms.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> p.s.s. These additional bonuses/bribes are not available to the
public – only valuable members like you! <strong><a href=" &
Chr(34) & "http://www.powerquotes plus.net/renew_1.asp?mem _email=" &
mem_email & Chr(34) & ">Renew today</a></strong> and, at the least, you
can walk away with some tools you will not find anywhere else on the
net!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> p.s.s.s. Remember just one more week!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<hr width=" & Chr(34) & "95%" & Chr(34) & "
size=" & Chr(34) & "1" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "1" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">If you would like your name removed from future <strong>Powerqu otes
Plus</strong> mailings, please send an email to <strong><a href=" &
Chr(34) & "mailto:se***** @powerquotesplu s.net?Subject=R emove from PQ+
Mailings" & Chr(34) & ">se*****@power quotesplus.net</a></strong> with
your request.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "1" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">You were sent this email because you are a member of
<strong>Powerqu otes Plus</strong> using the following email: " &
mem_email & "</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p align=" & Chr(34) & "center" & Chr(34) &
"><font size=" & Chr(34) & "1" & Chr(34) & " face=" & Chr(34) &
"Verdana, Arial, Helvetica, sans-serif" & Chr(34) & ">(Pay member
reminder email)</font></p>" & vbCrlf & ""
MailBody = MailBody & "</td>" & vbCrlf & ""
MailBody = MailBody & "</tr>" & vbCrlf & ""
MailBody = MailBody & "</table>" & vbCrlf & ""
MailBody = MailBody & "</body>" & vbCrlf & ""
MailBody = MailBody & "</html>"

Dim objMsg
Set objMsg = Server.CreateOb ject("CDONTS.Ne wMail")
objMsg.From = "ke***@powerquo tesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyForm at = 0
objMsg.MailForm at = 0
objMsg.Send

Set objMsg = nothing

' update database

SQLstmt = "UPDATE tbl_pqplus_memb ers SET "
SQLStmt = SQLstmt & "action_status= '" & email_action & "'"
SQLStmt = SQLStmt & " WHERE mem_email='" & mem_email & "'"

Set RS = Conn.Execute(SQ LStmt)

If err.number>0 then
response.write "VBScript Errors Occured:" & "<P>"
response.write "Error Number=" & err.number & "<P>"
response.write "Error Descr.=" & err.description & "<P>"
response.write "Help Context=" & err.helpcontext & "<P>"
response.write "Help Path=" & err.helppath & "<P>"
response.write "Native Error=" & err.nativeerror & "<P>"
response.write "Source=" & err.source & "<P>"
response.write "SQLState=" & err.sqlstate & "<P>"
end if
IF conn.errors.cou nt> 0 then
response.write "Database Errors Occured" & "<P>"
response.write SQLstmt & "<P>"
for counter= 0 to conn.errors.cou nt
response.write "Error #" & conn.errors(cou nter).number & "<P>"
response.write "Error desc. -> " & conn.errors(cou nter).descripti on & "<P>" next
else
end if

end if

'end reminder email

next

rs.close
set rs=nothing
Conn.Close
set conn=nothing

Response.Redire ct ("subscribers.a sp")

%>

Jul 22 '05 #2
Stop using CDONTS already. See http://www.aspfaq.com/2026
Stop using a DSN. See http://www.aspfaq.com/2126
If you're using SQL Server:
consider using mail from within SQL Server - http://www.aspfaq.com/2403
use stored procedures - http://www.aspfaq.com/2201

Just inside your FOR loop, place this:

MailBody = ""

Otherwise, on the second iteration, you're just adding more text to the
MailBody you had in the previous iteration.

I also recommend keeping this big block of code in an #include file so you
don't have to look at it when you're trying to develop/debug. I notice you
never use mem_email or mem_first within the body itself, but it would be
easy to incorporate. In the include file:

<%
mailbody = "Hello __firstname__, big long string here with a bunch of
useless HTML that will never be seen by most viewers..."
%>

And in your code:

For iLoop = 0 to iCount
mailbody = replace(mailbod y, "__firstname__" , mem_first)
Set objMsg = CreateObject("C DONTS.NewMail")
objMsg.From = "ke***@powerquo tesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyForm at = 0
objMsg.MailForm at = 0
objMsg.Send
Set objMsg = nothing
Next

Isn't that much easier to look at?????

--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.


"BaWork" <ba****@sprynet .com> wrote in message
news:O7******** ******@TK2MSFTN GP15.phx.gbl...
I have a web form where a client can select which site members to send
an email to.

This form is populated from the contents of the member table, so the
form can have 0-x names listed on it depending on member expiration dates.

When the form is submitted, the code loops through the form contents and
sends an email to those members that meet the selected criteria.

All this worked perfectly when I was sending text emails, but since I
changed, it sends the message correctly, but the last person gets
everyone else as well. For example, if I have three members (mem1, mem2
and mem3) to send emails to, here is what happens

mem1 gets the correctly formatted message

mem2 gets mem1's correctly formatted message plus mem2's message - one
right after the other.

mem3 gets mem1's correctly formated message, mem2's correctly formatted
message and mem3's message - one right after the other.

I'm not talking separate emails here, mem3 for example gets the body
content 3 times in one message, all correct for each member.

Here is the code, sorry it is long, but I didn't want to leave anything
out. I literally just swapped the plain text code for the HTML code and
added the necessary code in the send portion to send HTML rather than
plain text. I didn't change the logic at all.

Thanks

Brett

************** Code *************** ********

<%@LANGUAGE="VB SCRIPT" CODEPAGE="1252" %>
<%
on error resume next

iCount = Request.form("i Count")
iCount = iCount - 1

Set Conn = Server.CreateOb ject("ADODB.Con nection")
conn.open "DSN=XXXXXXXXXX XX"

'Now, we want to loop through each form element

Dim iLoop
For iLoop = 0 to iCount

'Request form elements

mem_first = request.form(iL oop & ".mem_first ")
mem_email = request.form(iL oop & ".mem_email ")
email_action = request.form(iL oop & ".email_action" )

'Send reminder email

If email_action = "reminder" then

MailBody = MailBody & "<html>" & vbCrlf & ""
MailBody = MailBody & "<body bgcolor=" & Chr(34) & "#FFCC66" & Chr(34) &
" text=" & Chr(34) & "#000000" & Chr(34) & " link=" & Chr(34) &
"#0033FF" & Chr(34) & " vlink=" & Chr(34) & "#0033FF" & Chr(34) & "
alink=" & Chr(34) & "#FF9900" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<p>&nbsp;</p>" & vbCrlf & ""
MailBody = MailBody & "<table width=" & Chr(34) & "600" & Chr(34) & "
border=" & Chr(34) & "3" & Chr(34) & " align=" & Chr(34) & "center" &
Chr(34) & " cellpadding=" & Chr(34) & "25" & Chr(34) & " cellspacing=" &
Chr(34) & "0" & Chr(34) & " bordercolor=" & Chr(34) & "#FF6600" &
Chr(34) & " bgcolor=" & Chr(34) & "#FFFFFF" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<tr>" & vbCrlf & ""
MailBody = MailBody & "<td valign=" & Chr(34) & "top" & Chr(34) & ">" &
vbCrlf & ""
MailBody = MailBody & "<p align=" & Chr(34) & "center" & Chr(34) &
"><b><font color=" & Chr(34) & "#FF6600" & Chr(34) & " size=" & Chr(34)
& "5" & Chr(34) & " face=" & Chr(34) & "Verdana, Arial, Helvetica,
sans-serif" & Chr(34) & ">Powerquot es Plus</font></b></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">From the desk of Kevin Eikenberry:</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Your <strong>Powerqu otes Plus</strong> membership will expire in one
week and I don’t want to lose you! </font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">With only one week left, I want to make sure you have plenty of time
to <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">renew your membership</a></strong> so you don’t miss
even one day of motivation and inspiration in your inbox.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">I’m sure if you spent some time looking through the private
membership site, worked through the questions, and applied all these
tools to your life, you’ll agree with me that this service is
filled with some incredible resources.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">They can give your entire day a new outlook and some great actions to
take – right?</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">We are now offering recurring billing so you can pay a very small
investment each month to get this powerful information. For only .95 a
month, less than the price of a couple cups of coffee at Starbucks you
can have hundreds of dollars worth of information and help.</font></p>"
& vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Or you can save 21% by paying just for the full year.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Get this… you will also get two weeks free for renewing to
<strong>Powerqu otes Plus</strong>! After 2 weeks it is a miniscule
amount to have a personal coach at your beck-and-call.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> I value you as a member.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">And I am willing to send you some free gifts just for <strong><a
href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">renewing your membership right
away</a></strong>.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">What are they?</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Three Special Reports:</font></p>" & vbCrlf & ""
MailBody = MailBody & "<ul>" & vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong><em>2 5 Great Quotations for your Personal
Success</em></strong></font></li>" & vbCrlf & ""
MailBody = MailBody & "<li><em><f ont size=" & Chr(34) & "2" & Chr(34) &
" face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong>2 5 Powerful Quotations for your Professional
Success</strong></font></em><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> – keep them at your side – or at your desk.</font></li>"
& vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong><em>2 5 Great Quotations to Help Others Succeed</em></strong>.
We all know that the more we help others, the more we achieve ourselves.
This is the perfect tool to help those around you life lives full of
abundance and joy.</font></li>" & vbCrlf & ""
MailBody = MailBody & "</ul>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">One last mega success bribe/bonus for your free
trial…</font></p>" & vbCrlf & ""
MailBody = MailBody & "<ul>" & vbCrlf & ""
MailBody = MailBody & "<li><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> An audio of live keynote speech entitled <strong><em>Unl eashing Your
Potential in 2005</em></strong>. Groups pay up to 00 for my keynote
speeches and here is one for you for fr’ee. This keynote provides
ideas, tools and techniques to help you reach your personal and
professional goals in 2005. Along with rock solid techniques on goal
setting, I will share specific ideas to set you up for your best year
ever.</font></li>" & vbCrlf & ""
MailBody = MailBody & "</ul>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Hopefully , the promise here is quite simple: <strong><a href=" &
Chr(34) & "http://www.powerquotes plus.net/renew_1.asp?mem _email=" &
mem_email & Chr(34) & ">Renew your membership today to Powerquotes
Plus</a></strong> and I will send you all of the free reports, along
with the live keynote recording.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">It’s easy to renew. <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">All you have to do is click on this private
link</a></strong> and you will automatically renew your membership
(starting with the 2 week no charge additional bonus) and the
“bribes” will be sent out to you right away.</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">I look forward to doing my part to help you be more
successful!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><img src=" & Chr(34) &
"http://www.powerquotes plus.net/images/kev_signature.j pg" & Chr(34) & "
width=" & Chr(34) & "53" & Chr(34) & " height=" & Chr(34) & "58" &
Chr(34) & "></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">Kevin Eikenberry<br>< b>Powerquotes Plus</b> Founder</font></p>" &
vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">p.s. <strong><a href=" & Chr(34) &
"http://www.powerquotes plus.net/renew_1.asp?mem _email=" & mem_email &
Chr(34) & ">Renew your membership today</a></strong> and receive all the
special bonus reports, audio and complimentary two weeks. Please put
some serious thought into what it is you are willing to do to make your
future a success. The tools you receive, and the membership benefits you
get, will help you accomplish whatever you want… on your own
terms.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> p.s.s. These additional bonuses/bribes are not available to the
public – only valuable members like you! <strong><a href=" &
Chr(34) & "http://www.powerquotes plus.net/renew_1.asp?mem _email=" &
mem_email & Chr(34) & ">Renew today</a></strong> and, at the least, you
can walk away with some tools you will not find anywhere else on the
net!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "2" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"> p.s.s.s. Remember just one more week!</font></p>" & vbCrlf & ""
MailBody = MailBody & "<hr width=" & Chr(34) & "95%" & Chr(34) & "
size=" & Chr(34) & "1" & Chr(34) & ">" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "1" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">If you would like your name removed from future <strong>Powerqu otes
Plus</strong> mailings, please send an email to <strong><a href=" &
Chr(34) & "mailto:se***** @powerquotesplu s.net?Subject=R emove from PQ+
Mailings" & Chr(34) & ">se*****@power quotesplus.net</a></strong> with
your request.</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p><font size=" & Chr(34) & "1" & Chr(34) & "
face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
">You were sent this email because you are a member of
<strong>Powerqu otes Plus</strong> using the following email: " &
mem_email & "</font></p>" & vbCrlf & ""
MailBody = MailBody & "<p align=" & Chr(34) & "center" & Chr(34) &
"><font size=" & Chr(34) & "1" & Chr(34) & " face=" & Chr(34) &
"Verdana, Arial, Helvetica, sans-serif" & Chr(34) & ">(Pay member
reminder email)</font></p>" & vbCrlf & ""
MailBody = MailBody & "</td>" & vbCrlf & ""
MailBody = MailBody & "</tr>" & vbCrlf & ""
MailBody = MailBody & "</table>" & vbCrlf & ""
MailBody = MailBody & "</body>" & vbCrlf & ""
MailBody = MailBody & "</html>"

Dim objMsg
Set objMsg = Server.CreateOb ject("CDONTS.Ne wMail")
objMsg.From = "ke***@powerquo tesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyForm at = 0
objMsg.MailForm at = 0
objMsg.Send

Set objMsg = nothing

' update database

SQLstmt = "UPDATE tbl_pqplus_memb ers SET "
SQLStmt = SQLstmt & "action_status= '" & email_action & "'"
SQLStmt = SQLStmt & " WHERE mem_email='" & mem_email & "'"

Set RS = Conn.Execute(SQ LStmt)

If err.number>0 then
response.write "VBScript Errors Occured:" & "<P>"
response.write "Error Number=" & err.number & "<P>"
response.write "Error Descr.=" & err.description & "<P>"
response.write "Help Context=" & err.helpcontext & "<P>"
response.write "Help Path=" & err.helppath & "<P>"
response.write "Native Error=" & err.nativeerror & "<P>"
response.write "Source=" & err.source & "<P>"
response.write "SQLState=" & err.sqlstate & "<P>"
end if
IF conn.errors.cou nt> 0 then
response.write "Database Errors Occured" & "<P>"
response.write SQLstmt & "<P>"
for counter= 0 to conn.errors.cou nt
response.write "Error #" & conn.errors(cou nter).number & "<P>"
response.write "Error desc. -> " & conn.errors(cou nter).descripti on & "<P>" next
else
end if

end if

'end reminder email

next

rs.close
set rs=nothing
Conn.Close
set conn=nothing

Response.Redire ct ("subscribers.a sp")

%>

Jul 22 '05 #3
Patrice wrote:
You likely forgot to clear the string that contains the HTML code for each
message...

Patrice

I tried that and it didn't work - maybe I did it wrong. What would be
the correct syntax?

Wouldn't it just be:

MailBody = ""

and I place it just above this piece of code:

Set objMsg = nothing

I didn't have to do that with the plain text version though....

Thanks

Brett
Jul 22 '05 #4
You should put it at the top.

Plus, because of on error resume next, perhaps the line is being skipped,
who knows what's happening when you're creating and destroying that huge
object every time in your loop...

--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.


"BaWork" <ba****@sprynet .com> wrote in message
news:#c******** ******@TK2MSFTN GP12.phx.gbl...
Patrice wrote:
You likely forgot to clear the string that contains the HTML code for each message...

Patrice

I tried that and it didn't work - maybe I did it wrong. What would be
the correct syntax?

Wouldn't it just be:

MailBody = ""

and I place it just above this piece of code:

Set objMsg = nothing

I didn't have to do that with the plain text version though....

Thanks

Brett

Jul 22 '05 #5
Gazing into my crystal ball I observed "Aaron [SQL Server MVP]"
<te*****@dnartr eb.noraa> writing in
news:u4******** ******@tk2msftn gp13.phx.gbl:
Stop using CDONTS already. See http://www.aspfaq.com/2026
Stop using a DSN. See http://www.aspfaq.com/2126
If you're using SQL Server:
consider using mail from within SQL Server -
http://www.aspfaq.com/2403 use stored procedures -
http://www.aspfaq.com/2201

Just inside your FOR loop, place this:

MailBody = ""

Otherwise, on the second iteration, you're just adding more text to the
MailBody you had in the previous iteration.

I also recommend keeping this big block of code in an #include file so
you don't have to look at it when you're trying to develop/debug. I
notice you never use mem_email or mem_first within the body itself, but
it would be easy to incorporate. In the include file:

<%
mailbody = "Hello __firstname__, big long string here with a bunch
of
useless HTML that will never be seen by most viewers..."
%>

And in your code:

For iLoop = 0 to iCount
mailbody = replace(mailbod y, "__firstname__" , mem_first)
Set objMsg = CreateObject("C DONTS.NewMail")
objMsg.From = "ke***@powerquo tesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyForm at = 0
objMsg.MailForm at = 0
objMsg.Send
Set objMsg = nothing
Next

Isn't that much easier to look at?????


Additionally, remove all the presenational markup and use CSS, but put the
CSS in the head (some mail clients remove/ignore external stylesheets). It
would probably also do good to validate the HTML <http://validator.w3.or g>
as you might have some unclosed tags.

--
Adrienne Boswell
http://www.cavalcade-of-coding.info
Please respond to the group so others can share
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1880
by: Steve | last post by:
I've been told that an e-mail can be constructed using headers so that both a text and HTML version can be sent out simultaneously and the e-mail client will display the type that it can handle (http://www.wilsonweb.com/wmt5/html-email-multi.htm). How is this done using CDONTS and ASP to send an e-mail? Is there a specific field that the content type gets put into? I tried putting: Content-Type: multipart/alternative;...
10
4976
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are working with we put these mailshots in the bcc field of the mails. This can sometimes cause a problem as we are getting alot of mails bounced back. I would like to write a script to have these emails sent out individually using the to: field of the...
6
4683
by: NetNoise | last post by:
Hi. I'm using CDO SYS to send email messages. I can attach a file just fine. However, I need to attach an HTML page that's generated on the fly by my ASP code. The attachment source code gets assembled into a VB string. How do I attach this? I think there was an easy way in CDONTS but that's no longer an option. Thanks in advance. -Geoff
4
2970
by: Francois Keyeux | last post by:
hello everyone: i have a web site built using vbasic active server scripting running on iis (it works on either iis 50 and 60, but is designed for iis 50) i know how to create a plain text email by creating a text file, with content following certain format, and saving that file into the correct '..\mailroot\pickup' folder, and it is working fine
2
1747
by: Paul Turley | last post by:
Does anyone have some sample code for sending an HTML formatted message using CDONTS? Thanks RE: Sending HTML formatted mail using CDONTS -- Paul Turley, MCSD, MCAD, MCT, MSF Practitioner, A+ Technician
3
1627
by: sagar | last post by:
i tried to send a email through asp using codes given on the book. but there is an error saying: ActiveX component can't create object: 'CDONTS.NewMail' what's that error for.,,and how can i correct it.
4
5049
by: Roger Withnell | last post by:
I'm sending Russian text in an email generated from the website which displays in the email as ?????????? The website is set to codepage 65001 and the charset to utf-8. Please advise. Posted Via Usenet.com Premium Usenet Newsgroup Services
3
3297
by: tamaker | last post by:
I have Road Runner cable internet access and Im working in a local development environment (writing .ASP) and have a site running on my network on a windows xp pro machine via IIS with CDONTS installed. When I try to send a confirmation email (simple text) via CDONTS the message is built but remains on the server in the QUEUE folder ... how can I tweak the SMTP settings on the server to allow me to send email out from the server... ...
7
3768
by: Jason1983 | last post by:
Hello sir, When iam trying to send emails to my user accounts which are gmail id's using my application it is giving me this error. Here is the error... Server object error 'ASP 0177 : 800401f3' Server.CreateObject Failed Not sending CDONTS created e-mails. Here is the related code .... '******************************************************** 'Creating CDONTS mail object and sending mail to user
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8936
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8894
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7776
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3071
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2360
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.