473,398 Members | 2,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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="VBSCRIPT" CODEPAGE="1252"%>
<%
on error resume next

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

Set Conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=XXXXXXXXXXXX"

'Now, we want to loop through each form element

Dim iLoop
For iLoop = 0 to iCount

'Request form elements

mem_first = request.form(iLoop & ".mem_first")
mem_email = request.form(iLoop & ".mem_email")
email_action = request.form(iLoop & ".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) & ">Powerquotes 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>Powerquotes 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.powerquotesplus.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>Powerquotes 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.powerquotesplus.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>25 Great Quotations for your Personal
Success</em></strong></font></li>" & vbCrlf & ""
MailBody = MailBody & "<li><em><font size=" & Chr(34) & "2" & Chr(34) &
" face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong>25 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>25 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>Unleashing 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.powerquotesplus.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.powerquotesplus.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.powerquotesplus.net/images/kev_signature.jpg" & 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.powerquotesplus.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.powerquotesplus.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>Powerquotes
Plus</strong> mailings, please send an email to <strong><a href=" &
Chr(34) & "mailto:se*****@powerquotesplus.net?Subject=Re move from PQ+
Mailings" & Chr(34) & ">se*****@powerquotesplus.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>Powerquotes 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.CreateObject("CDONTS.NewMail")
objMsg.From = "ke***@powerquotesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyFormat = 0
objMsg.MailFormat = 0
objMsg.Send

Set objMsg = nothing

' update database

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

Set RS = Conn.Execute(SQLStmt)

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.count> 0 then
response.write "Database Errors Occured" & "<P>"
response.write SQLstmt & "<P>"
for counter= 0 to conn.errors.count
response.write "Error #" & conn.errors(counter).number & "<P>"
response.write "Error desc. -> " & conn.errors(counter).description & "<P>"
next
else
end if

end if

'end reminder email

next

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

Response.Redirect ("subscribers.asp")

%>
Jul 22 '05 #1
5 2598
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**************@TK2MSFTNGP15.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="VBSCRIPT" CODEPAGE="1252"%>
<%
on error resume next

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

Set Conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=XXXXXXXXXXXX"

'Now, we want to loop through each form element

Dim iLoop
For iLoop = 0 to iCount

'Request form elements

mem_first = request.form(iLoop & ".mem_first")
mem_email = request.form(iLoop & ".mem_email")
email_action = request.form(iLoop & ".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) & ">Powerquotes 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>Powerquotes 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.powerquotesplus.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>Powerquotes 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.powerquotesplus.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>25 Great Quotations for your Personal
Success</em></strong></font></li>" & vbCrlf & ""
MailBody = MailBody & "<li><em><font size=" & Chr(34) & "2" & Chr(34) &
" face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong>25 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>25 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>Unleashing 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.powerquotesplus.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.powerquotesplus.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.powerquotesplus.net/images/kev_signature.jpg" & 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.powerquotesplus.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.powerquotesplus.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>Powerquotes
Plus</strong> mailings, please send an email to <strong><a href=" &
Chr(34) & "mailto:se*****@powerquotesplus.net?Subject=Re move from PQ+
Mailings" & Chr(34) & ">se*****@powerquotesplus.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>Powerquotes 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.CreateObject("CDONTS.NewMail")
objMsg.From = "ke***@powerquotesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyFormat = 0
objMsg.MailFormat = 0
objMsg.Send

Set objMsg = nothing

' update database

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

Set RS = Conn.Execute(SQLStmt)

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.count> 0 then
response.write "Database Errors Occured" & "<P>"
response.write SQLstmt & "<P>"
for counter= 0 to conn.errors.count
response.write "Error #" & conn.errors(counter).number & "<P>"
response.write "Error desc. -> " & conn.errors(counter).description & "<P>" next
else
end if

end if

'end reminder email

next

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

Response.Redirect ("subscribers.asp")

%>

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(mailbody, "__firstname__", mem_first)
Set objMsg = CreateObject("CDONTS.NewMail")
objMsg.From = "ke***@powerquotesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyFormat = 0
objMsg.MailFormat = 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**************@TK2MSFTNGP15.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="VBSCRIPT" CODEPAGE="1252"%>
<%
on error resume next

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

Set Conn = Server.CreateObject("ADODB.Connection")
conn.open "DSN=XXXXXXXXXXXX"

'Now, we want to loop through each form element

Dim iLoop
For iLoop = 0 to iCount

'Request form elements

mem_first = request.form(iLoop & ".mem_first")
mem_email = request.form(iLoop & ".mem_email")
email_action = request.form(iLoop & ".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) & ">Powerquotes 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>Powerquotes 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.powerquotesplus.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>Powerquotes 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.powerquotesplus.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>25 Great Quotations for your Personal
Success</em></strong></font></li>" & vbCrlf & ""
MailBody = MailBody & "<li><em><font size=" & Chr(34) & "2" & Chr(34) &
" face=" & Chr(34) & "Verdana, Arial, Helvetica, sans-serif" & Chr(34) &
"><strong>25 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>25 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>Unleashing 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.powerquotesplus.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.powerquotesplus.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.powerquotesplus.net/images/kev_signature.jpg" & 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.powerquotesplus.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.powerquotesplus.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>Powerquotes
Plus</strong> mailings, please send an email to <strong><a href=" &
Chr(34) & "mailto:se*****@powerquotesplus.net?Subject=Re move from PQ+
Mailings" & Chr(34) & ">se*****@powerquotesplus.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>Powerquotes 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.CreateObject("CDONTS.NewMail")
objMsg.From = "ke***@powerquotesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyFormat = 0
objMsg.MailFormat = 0
objMsg.Send

Set objMsg = nothing

' update database

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

Set RS = Conn.Execute(SQLStmt)

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.count> 0 then
response.write "Database Errors Occured" & "<P>"
response.write SQLstmt & "<P>"
for counter= 0 to conn.errors.count
response.write "Error #" & conn.errors(counter).number & "<P>"
response.write "Error desc. -> " & conn.errors(counter).description & "<P>" next
else
end if

end if

'end reminder email

next

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

Response.Redirect ("subscribers.asp")

%>

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**************@TK2MSFTNGP12.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*****@dnartreb.noraa> writing in
news:u4**************@tk2msftngp13.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(mailbody, "__firstname__", mem_first)
Set objMsg = CreateObject("CDONTS.NewMail")
objMsg.From = "ke***@powerquotesplus.net"
objMsg.To = mem_email
objMsg.Subject = "About Your Powerquotes Plus Membership"
objMsg.Body = MailBody
objMsg.BodyFormat = 0
objMsg.MailFormat = 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.org>
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
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...
10
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...
6
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...
4
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...
2
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...
3
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...
4
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. ...
3
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...
7
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'...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...

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.