Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CDONTS not rs.movenext & start new email

Status
Not open for further replies.

jcroft

Programmer
Aug 23, 2001
52
US
What have I done wrong?? this code produces and sends one email to each of entries in database, but the email contains copies of the previous emails in addition to the correct one...make sense??

if rs.EOF = false then
While rs.EOF = false
email = rs("Email")
'sending email to customer service
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.MailFormat = cdoMailFormatMIME
MyCDONTSMail.From = "whoever@home.com"
MyCDONTSMail.To= email
MyCDONTSMail.bCc= "jjj@mmm.com"
MyCDONTSMail.Subject= Request.Form("Subject")
MyCDONTSMail.BodyFormat = cdoBodyFormatHTML
MyBody = MyBody & &quot;To: &quot; & rs(&quot;fname&quot;) & &quot; &quot; & rs(&quot;lname&quot;) & &quot;<br><BR>&quot;
MyBody = MyBody & &quot;From: &quot; & &quot;Mr. Magoo&quot; & &quot;<br><BR>&quot;
MyBody = MyBody & body & &quot;<br><BR>&quot;
MyBody = MyBody & &quot;<A href= & rs1(&quot;ID&quot;) & &quot;and?number=&quot; & rs(&quot;number&quot;) & &quot;>&quot; & &quot;Click Here to Respond&quot; & &quot;</A>&quot; & &quot;<br>&quot;
MyCDONTSMail.Body= MyBody
MyCDONTSMail.Send
set MyCDONTSMail=nothing
rs.MoveNext
WEND
end if june.croft@sfmco.com

--only those that do not try, fail--
 
Your MyBody variable looks like its is incorrectly formatted
, try using the following...
MyBody = MyBody & body & &quot;<BR><BR>&quot;
MyBody = MyBody & &quot;<A href=&quot;&quot; & rs1(&quot;ID&quot;) & &quot;&number=&quot; & rs(&quot;number&quot;) & &quot;&quot;&quot;>Click Here to Respond</A><br>&quot;
 
When you start defining the body of the message, you start with MyBody = MyBody & ...... etc., which will take the MyBody message from the previous email. If you remove the MyBody & from the first statement filling the MyBody variable, you should be all set:


MyCDONTSMail.BodyFormat = cdoBodyFormatHTML
MyBody = &quot;To: &quot; & rs(&quot;fname&quot;) & &quot; &quot; & rs(&quot;lname&quot;) & &quot;<br><BR>&quot;
 
lobstah....you are a life (and last nerve) saver...thank you.
June june.croft@sfmco.com

--only those that do not try, fail--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top